From 0b5f187e4e85372dbb3c40559502a8bb8259a2d7 Mon Sep 17 00:00:00 2001 From: John Vu Date: Mon, 4 Dec 2023 12:06:04 -0800 Subject: [PATCH 1/2] Update python library to use codegen --- .dockerignore | 3 - .github/workflows/build.yml | 32 - .../workflows/publish-to-github-releases.yml | 17 - .github/workflows/publish-to-pypi.yml | 42 -- .github/workflows/publish.yml | 99 +-- .gitignore | 71 +- .swagger-codegen-ignore | 3 - Dockerfile | 20 - README.md | 183 ----- TESTING | 4 - VERSION | 1 - asana/__init__.py | 6 - asana/client.py | 367 ---------- asana/error.py | 105 --- asana/page_iterator.py | 134 ---- asana/resources/__init__.py | 35 - asana/resources/attachments.py | 36 - asana/resources/audit_log_api.py | 19 - asana/resources/batch_api.py | 6 - asana/resources/custom_field_settings.py | 26 - asana/resources/custom_fields.py | 140 ---- asana/resources/events.py | 22 - asana/resources/gen/__init__.py | 32 - asana/resources/gen/attachments.py | 49 -- asana/resources/gen/audit_log_api.py | 25 - asana/resources/gen/batch_api.py | 18 - asana/resources/gen/custom_field_settings.py | 37 - asana/resources/gen/custom_fields.py | 122 ---- asana/resources/gen/events.py | 20 - asana/resources/gen/goal_relationships.py | 76 -- asana/resources/gen/goals.py | 153 ---- asana/resources/gen/jobs.py | 19 - asana/resources/gen/memberships.py | 65 -- asana/resources/gen/message.py | 19 - asana/resources/gen/organization_exports.py | 34 - asana/resources/gen/portfolio_memberships.py | 54 -- asana/resources/gen/portfolios.py | 175 ----- asana/resources/gen/project_briefs.py | 61 -- asana/resources/gen/project_memberships.py | 36 - asana/resources/gen/project_statuses.py | 63 -- asana/resources/gen/project_templates.py | 66 -- asana/resources/gen/projects.py | 282 -------- asana/resources/gen/sections.py | 105 --- asana/resources/gen/status_updates.py | 65 -- asana/resources/gen/stories.py | 79 --- asana/resources/gen/tags.py | 128 ---- asana/resources/gen/tasks.py | 443 ------------ asana/resources/gen/team_memberships.py | 70 -- asana/resources/gen/teams.py | 112 --- asana/resources/gen/time_periods.py | 37 - asana/resources/gen/typeahead.py | 23 - asana/resources/gen/user_task_lists.py | 34 - asana/resources/gen/users.py | 82 --- asana/resources/gen/webhooks.py | 77 --- asana/resources/gen/workspace_memberships.py | 52 -- asana/resources/gen/workspaces.py | 76 -- asana/resources/goal_relationships.py | 5 - asana/resources/goals.py | 6 - asana/resources/jobs.py | 15 - asana/resources/memberships.py | 5 - asana/resources/message.py | 6 - asana/resources/organization_exports.py | 30 - asana/resources/portfolio_memberships.py | 42 -- asana/resources/portfolios.py | 184 ----- asana/resources/project_briefs.py | 6 - asana/resources/project_memberships.py | 29 - asana/resources/project_statuses.py | 56 -- asana/resources/project_templates.py | 6 - asana/resources/projects.py | 258 ------- asana/resources/sections.py | 119 ---- asana/resources/status_updates.py | 6 - asana/resources/stories.py | 70 -- asana/resources/tags.py | 118 ---- asana/resources/tasks.py | 472 ------------- asana/resources/team_memberships.py | 6 - asana/resources/teams.py | 86 --- asana/resources/time_periods.py | 6 - asana/resources/typeahead.py | 6 - asana/resources/user_task_lists.py | 60 -- asana/resources/users.py | 68 -- asana/resources/webhooks.py | 64 -- asana/resources/workspace_memberships.py | 6 - asana/resources/workspaces.py | 97 --- asana/session.py | 20 - asana/version.py | 1 - codegen/swagger/README.md | 74 ++ codegen/swagger/pom.xml | 129 ++++ .../com/asana/codegen/ExampleUtility.java | 27 + .../codegen/PythonClientCodegenGenerator.java | 195 ++++++ .../main/java/com/asana/codegen/ReadMe.java | 164 +++++ .../io.swagger.codegen.v3.CodegenConfig | 1 + codegen/templates/README.mustache | 651 ++++++++++++++++++ codegen/templates/__init__package.mustache | 14 + codegen/templates/__init__pagination.mustache | 11 + codegen/templates/api.mustache | 306 ++++++++ codegen/templates/api_client.mustache | 633 +++++++++++++++++ codegen/templates/api_doc.mustache | 49 ++ codegen/templates/code_sample.mustache | 36 + codegen/templates/code_sample_client.mustache | 20 + codegen/templates/code_samples.mustache | 11 + codegen/templates/configuration.mustache | 284 ++++++++ codegen/templates/event_iterator.mustache | 38 + codegen/templates/gitignore.mustache | 67 ++ codegen/templates/page_iterator.mustache | 64 ++ codegen/templates/setup.mustache | 52 ++ deploy.py | 54 -- examples/example-create-task.py | 46 -- examples/example-script.py | 85 --- examples/example-server.py | 77 --- examples/example-summary-task.py | 106 --- requirements.txt | 4 - samples/attachments_sample.yaml | 33 - samples/audit_log_api_sample.yaml | 9 - samples/batch_api_sample.yaml | 9 - samples/custom_field_settings_sample.yaml | 17 - samples/custom_fields_sample.yaml | 65 -- samples/events_sample.yaml | 9 - samples/goal_relationships_sample.yaml | 41 -- samples/goals_sample.yaml | 81 --- samples/jobs_sample.yaml | 9 - samples/memberships_sample.yaml | 33 - samples/message_sample.yaml | 9 - samples/organization_exports_sample.yaml | 17 - samples/portfolio_memberships_sample.yaml | 25 - samples/portfolios_sample.yaml | 97 --- samples/project_briefs_sample.yaml | 33 - samples/project_memberships_sample.yaml | 17 - samples/project_statuses_sample.yaml | 33 - samples/project_templates_sample.yaml | 33 - samples/projects_sample.yaml | 153 ---- samples/sections_sample.yaml | 57 -- samples/status_updates_sample.yaml | 33 - samples/stories_sample.yaml | 41 -- samples/tags_sample.yaml | 65 -- samples/tasks_sample.yaml | 209 ------ samples/team_memberships_sample.yaml | 33 - samples/teams_sample.yaml | 57 -- samples/time_periods_sample.yaml | 17 - samples/typeahead_sample.yaml | 9 - samples/user_task_lists_sample.yaml | 17 - samples/users_sample.yaml | 41 -- samples/webhooks_sample.yaml | 41 -- samples/workspace_memberships_sample.yaml | 25 - samples/workspaces_sample.yaml | 41 -- setup.cfg | 5 - setup.py | 44 -- swagger_templates/api.mustache | 27 - swagger_templates/api_doc.mustache | 10 - swagger_templates/python-config.json | 6 - tests/__init__.py | 0 tests/helpers.py | 40 -- tests/test_client.py | 407 ----------- tests/test_client_attachments.py | 46 -- tests/test_client_audit_log_api.py | 152 ---- tests/test_client_custom_field_settings.py | 43 -- tests/test_client_custom_fields.py | 65 -- tests/test_client_events.py | 78 --- tests/test_client_jobs.py | 13 - tests/test_client_organization_exports.py | 40 -- tests/test_client_portfolio_memberships.py | 34 - tests/test_client_portfolios.py | 95 --- tests/test_client_projects.py | 104 --- tests/test_client_sections.py | 114 --- tests/test_client_stories.py | 57 -- tests/test_client_tags.py | 37 - tests/test_client_tasks.py | 239 ------- tests/test_client_teams.py | 13 - tests/test_client_user_task_lists.py | 33 - tests/test_client_users.py | 42 -- tests/test_client_webhooks.py | 38 - tests/test_client_workspaces.py | 20 - tests/test_errors.py | 24 - 172 files changed, 2949 insertions(+), 9497 deletions(-) delete mode 100644 .dockerignore delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/publish-to-github-releases.yml delete mode 100644 .github/workflows/publish-to-pypi.yml delete mode 100644 .swagger-codegen-ignore delete mode 100644 Dockerfile delete mode 100644 README.md delete mode 100644 TESTING delete mode 100644 VERSION delete mode 100644 asana/__init__.py delete mode 100644 asana/client.py delete mode 100644 asana/error.py delete mode 100644 asana/page_iterator.py delete mode 100644 asana/resources/__init__.py delete mode 100644 asana/resources/attachments.py delete mode 100644 asana/resources/audit_log_api.py delete mode 100644 asana/resources/batch_api.py delete mode 100644 asana/resources/custom_field_settings.py delete mode 100644 asana/resources/custom_fields.py delete mode 100644 asana/resources/events.py delete mode 100644 asana/resources/gen/__init__.py delete mode 100644 asana/resources/gen/attachments.py delete mode 100644 asana/resources/gen/audit_log_api.py delete mode 100644 asana/resources/gen/batch_api.py delete mode 100644 asana/resources/gen/custom_field_settings.py delete mode 100644 asana/resources/gen/custom_fields.py delete mode 100644 asana/resources/gen/events.py delete mode 100644 asana/resources/gen/goal_relationships.py delete mode 100644 asana/resources/gen/goals.py delete mode 100644 asana/resources/gen/jobs.py delete mode 100644 asana/resources/gen/memberships.py delete mode 100644 asana/resources/gen/message.py delete mode 100644 asana/resources/gen/organization_exports.py delete mode 100644 asana/resources/gen/portfolio_memberships.py delete mode 100644 asana/resources/gen/portfolios.py delete mode 100644 asana/resources/gen/project_briefs.py delete mode 100644 asana/resources/gen/project_memberships.py delete mode 100644 asana/resources/gen/project_statuses.py delete mode 100644 asana/resources/gen/project_templates.py delete mode 100644 asana/resources/gen/projects.py delete mode 100644 asana/resources/gen/sections.py delete mode 100644 asana/resources/gen/status_updates.py delete mode 100644 asana/resources/gen/stories.py delete mode 100644 asana/resources/gen/tags.py delete mode 100644 asana/resources/gen/tasks.py delete mode 100644 asana/resources/gen/team_memberships.py delete mode 100644 asana/resources/gen/teams.py delete mode 100644 asana/resources/gen/time_periods.py delete mode 100644 asana/resources/gen/typeahead.py delete mode 100644 asana/resources/gen/user_task_lists.py delete mode 100644 asana/resources/gen/users.py delete mode 100644 asana/resources/gen/webhooks.py delete mode 100644 asana/resources/gen/workspace_memberships.py delete mode 100644 asana/resources/gen/workspaces.py delete mode 100644 asana/resources/goal_relationships.py delete mode 100644 asana/resources/goals.py delete mode 100644 asana/resources/jobs.py delete mode 100644 asana/resources/memberships.py delete mode 100644 asana/resources/message.py delete mode 100644 asana/resources/organization_exports.py delete mode 100644 asana/resources/portfolio_memberships.py delete mode 100644 asana/resources/portfolios.py delete mode 100644 asana/resources/project_briefs.py delete mode 100644 asana/resources/project_memberships.py delete mode 100644 asana/resources/project_statuses.py delete mode 100644 asana/resources/project_templates.py delete mode 100644 asana/resources/projects.py delete mode 100644 asana/resources/sections.py delete mode 100644 asana/resources/status_updates.py delete mode 100644 asana/resources/stories.py delete mode 100644 asana/resources/tags.py delete mode 100644 asana/resources/tasks.py delete mode 100644 asana/resources/team_memberships.py delete mode 100644 asana/resources/teams.py delete mode 100644 asana/resources/time_periods.py delete mode 100644 asana/resources/typeahead.py delete mode 100644 asana/resources/user_task_lists.py delete mode 100644 asana/resources/users.py delete mode 100644 asana/resources/webhooks.py delete mode 100644 asana/resources/workspace_memberships.py delete mode 100644 asana/resources/workspaces.py delete mode 100644 asana/session.py delete mode 100644 asana/version.py create mode 100644 codegen/swagger/README.md create mode 100644 codegen/swagger/pom.xml create mode 100644 codegen/swagger/src/main/java/com/asana/codegen/ExampleUtility.java create mode 100644 codegen/swagger/src/main/java/com/asana/codegen/PythonClientCodegenGenerator.java create mode 100644 codegen/swagger/src/main/java/com/asana/codegen/ReadMe.java create mode 100644 codegen/swagger/src/main/resources/META-INF/services/io.swagger.codegen.v3.CodegenConfig create mode 100644 codegen/templates/README.mustache create mode 100644 codegen/templates/__init__package.mustache create mode 100644 codegen/templates/__init__pagination.mustache create mode 100644 codegen/templates/api.mustache create mode 100644 codegen/templates/api_client.mustache create mode 100644 codegen/templates/api_doc.mustache create mode 100644 codegen/templates/code_sample.mustache create mode 100644 codegen/templates/code_sample_client.mustache create mode 100644 codegen/templates/code_samples.mustache create mode 100644 codegen/templates/configuration.mustache create mode 100644 codegen/templates/event_iterator.mustache create mode 100644 codegen/templates/gitignore.mustache create mode 100644 codegen/templates/page_iterator.mustache create mode 100644 codegen/templates/setup.mustache delete mode 100755 deploy.py delete mode 100644 examples/example-create-task.py delete mode 100644 examples/example-script.py delete mode 100644 examples/example-server.py delete mode 100755 examples/example-summary-task.py delete mode 100644 requirements.txt delete mode 100644 samples/attachments_sample.yaml delete mode 100644 samples/audit_log_api_sample.yaml delete mode 100644 samples/batch_api_sample.yaml delete mode 100644 samples/custom_field_settings_sample.yaml delete mode 100644 samples/custom_fields_sample.yaml delete mode 100644 samples/events_sample.yaml delete mode 100644 samples/goal_relationships_sample.yaml delete mode 100644 samples/goals_sample.yaml delete mode 100644 samples/jobs_sample.yaml delete mode 100644 samples/memberships_sample.yaml delete mode 100644 samples/message_sample.yaml delete mode 100644 samples/organization_exports_sample.yaml delete mode 100644 samples/portfolio_memberships_sample.yaml delete mode 100644 samples/portfolios_sample.yaml delete mode 100644 samples/project_briefs_sample.yaml delete mode 100644 samples/project_memberships_sample.yaml delete mode 100644 samples/project_statuses_sample.yaml delete mode 100644 samples/project_templates_sample.yaml delete mode 100644 samples/projects_sample.yaml delete mode 100644 samples/sections_sample.yaml delete mode 100644 samples/status_updates_sample.yaml delete mode 100644 samples/stories_sample.yaml delete mode 100644 samples/tags_sample.yaml delete mode 100644 samples/tasks_sample.yaml delete mode 100644 samples/team_memberships_sample.yaml delete mode 100644 samples/teams_sample.yaml delete mode 100644 samples/time_periods_sample.yaml delete mode 100644 samples/typeahead_sample.yaml delete mode 100644 samples/user_task_lists_sample.yaml delete mode 100644 samples/users_sample.yaml delete mode 100644 samples/webhooks_sample.yaml delete mode 100644 samples/workspace_memberships_sample.yaml delete mode 100644 samples/workspaces_sample.yaml delete mode 100644 setup.cfg delete mode 100755 setup.py delete mode 100644 swagger_templates/api.mustache delete mode 100644 swagger_templates/api_doc.mustache delete mode 100644 swagger_templates/python-config.json delete mode 100644 tests/__init__.py delete mode 100644 tests/helpers.py delete mode 100644 tests/test_client.py delete mode 100644 tests/test_client_attachments.py delete mode 100644 tests/test_client_audit_log_api.py delete mode 100644 tests/test_client_custom_field_settings.py delete mode 100644 tests/test_client_custom_fields.py delete mode 100644 tests/test_client_events.py delete mode 100644 tests/test_client_jobs.py delete mode 100644 tests/test_client_organization_exports.py delete mode 100644 tests/test_client_portfolio_memberships.py delete mode 100644 tests/test_client_portfolios.py delete mode 100644 tests/test_client_projects.py delete mode 100644 tests/test_client_sections.py delete mode 100644 tests/test_client_stories.py delete mode 100644 tests/test_client_tags.py delete mode 100644 tests/test_client_tasks.py delete mode 100644 tests/test_client_teams.py delete mode 100644 tests/test_client_user_task_lists.py delete mode 100644 tests/test_client_users.py delete mode 100644 tests/test_client_webhooks.py delete mode 100644 tests/test_client_workspaces.py delete mode 100644 tests/test_errors.py diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 196a84ec..00000000 --- a/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -.git -*.pyc -__pycache__ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index a7a2389d..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Build - -on: - push: - branches: - - master - pull_request: - branches: - - master - -defaults: - run: - shell: bash - -jobs: - test: - name: pytest - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - run: pip install -r requirements.txt - - run: pytest - \ No newline at end of file diff --git a/.github/workflows/publish-to-github-releases.yml b/.github/workflows/publish-to-github-releases.yml deleted file mode 100644 index 5e4f6450..00000000 --- a/.github/workflows/publish-to-github-releases.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Publish to GitHub Releases - -on: - push: - tags: - - "v*.*.*" - -jobs: - build-n-publish-to-github: - name: Build and publish to GitHub Releases - runs-on: ubuntu-latest - steps: - - name: Publish to GitHub Releases - uses: softprops/action-gh-release@v1 - with: - # Use the newest commit message as the release description - body: ${{ github.event.head_commit.message }} diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml deleted file mode 100644 index c6aa1548..00000000 --- a/.github/workflows/publish-to-pypi.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI - -on: - release: - types: [published] - push: - tags: - - "v*.*.*" - -jobs: - build-n-publish-to-pypi: - name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.7 - uses: actions/setup-python@v3 - with: - python-version: 3.7 - - name: Install pypa/build - run: >- - python -m - pip install - build - --user - - name: Build a binary wheel and a source tarball - run: >- - python -m - build - --sdist - --wheel - --outdir dist/ - . - - name: Publish distribution 📦 to Test PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c4fa9d5f..cf18b79f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,57 +1,59 @@ -name: Bump Version and Publish +name: Generate client library + Publish 📦 to PyPI + Publish to GitHub Releases on: workflow_dispatch: inputs: - bumpVersion: - description: Choose a version number to bump + version: required: true - type: choice - options: - - patch - - minor - - major jobs: - bump-semantic-versioning: - name: Bump the semantic versioning for the package + generate-python-library: + name: Generate python client library runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python 3.7 - uses: actions/setup-python@v4 + - uses: actions/setup-java@v3 with: - python-version: 3.7 - - name: Run deploy script + distribution: "temurin" + java-version: "17" + - name: Setup environment variables run: | - git config user.name github-actions - git config user.email github-actions@github.com - python deploy.py ${{ inputs.bumpVersion }} - publish-to-github: - needs: bump-semantic-versioning - name: Publish to GitHub Releases - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: master - - name: Get version tag - id: tag - run: echo "version=v$(cat VERSION)" >> $GITHUB_OUTPUT - - name: Print version tag - run: echo ${{ steps.tag.outputs.version }} - - name: Publish to GitHub Releases - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + echo "generator_version=3.0.46" >> "$GITHUB_ENV" + echo "generator_name=swagger-codegen-cli.jar" >> "$GITHUB_ENV" + echo "jar_asana=codegen/swagger/target/AsanaClientCodegen-swagger-codegen-1.0.0.jar" >> "$GITHUB_ENV" + echo "actual_lang=com.asana.codegen.PythonClientCodegenGenerator" >> "$GITHUB_ENV" + echo "name=asana" >> "$GITHUB_ENV" + - name: Download generator + run: | + wget -q -O $generator_name https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/${{ env.generator_version }}/swagger-codegen-cli-${{ env.generator_version }}.jar + - name: Build custom code + run: | + pushd codegen/swagger >/dev/null + mvn package + popd >/dev/null + - name: Generate library + run: >- + java -cp "${{ env.jar_asana }}:${{ env.generator_name }}" + io.swagger.codegen.v3.cli.SwaggerCodegen + generate + --input-spec https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_sdk_oas.yaml + --template-dir "codegen/templates" + --lang "${{ env.actual_lang }}" + -DpackageName=${{ env.name }} + --additional-properties "packageVersion=${{ inputs.version }},projectName=${{ env.name }},packageName=${{ env.name }}" + - name: Clean up generator + run: rm -rf codegen/swagger/target ${{ env.generator_name }} + - name: Push changes to master branch + uses: EndBug/add-and-commit@v9 with: - tag_name: ${{ steps.tag.outputs.version }} - # Use the newest commit message as the release description - body: ${{ github.event.head_commit.message }} + message: 'Updated Python SDK: v${{ inputs.version }}' + committer_name: GitHub Actions + committer_email: actions@github.com + tag: 'v${{ inputs.version }} --force' + tag_push: '--force' build-n-publish-to-pypi: - needs: [bump-semantic-versioning, publish-to-github] - name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI + needs: generate-python-library + name: Build and publish Python 🐍 distributions 📦 to TestPyPI and PyPI runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -82,6 +84,21 @@ jobs: password: ${{ secrets.TEST_PYPI_API_TOKEN }} repository_url: https://test.pypi.org/legacy/ - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }} + publish-to-github: + needs: build-n-publish-to-pypi + name: Publish to GitHub Releases + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: master + - name: Publish to GitHub Releases + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ inputs.version }} diff --git a/.gitignore b/.gitignore index f6d87f8d..447b9425 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,67 @@ -.idea -/build -/dist -/*.egg-info +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class -__pycache__ -*.pyc +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* .cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.python-version + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints + +.travis.yml +git_push.sh diff --git a/.swagger-codegen-ignore b/.swagger-codegen-ignore deleted file mode 100644 index b0c534d4..00000000 --- a/.swagger-codegen-ignore +++ /dev/null @@ -1,3 +0,0 @@ -# Swagger Codegen Ignore - -test/* diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 345ea0f7..00000000 --- a/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM python:3 - -WORKDIR /app - -ADD requirements.txt /app/requirements.txt - -RUN pip install -r requirements.txt - -ADD asana /app/asana -ADD examples /app/examples -ADD tests /app/tests -ADD setup.py /app/setup.py -ADD README.md /app/README.md - -RUN find . -name '*.pyc' -delete - -RUN python --version -RUN python -m pytest - -RUN python setup.py bdist_egg diff --git a/README.md b/README.md deleted file mode 100644 index e1b215b7..00000000 --- a/README.md +++ /dev/null @@ -1,183 +0,0 @@ -# asana [![Build][github-actions-image]][github-actions-url] [![PyPi Version][pypi-image]][pypi-url] - -> **Warning** -> Python client library version `>4.X.X` is currently in BETA and subject to change. Please use v3.2.X for stable / production environments `pip install asana` or `pip install asana==3.2.2`. If you have feedback on the new version, please your feedback [here](https://form.asana.com/?k=C4sELCq6hAUsoWEY0kJwAA&d=15793206719). - -> You can try out our new python beta by installing version [v4.0.11](https://github.com/Asana/python-asana/tree/v4.0.11) (`pip install asana==4.0.11`) - -Python client library for Asana. - -Authentication --------------- - -### Personal Access Token - -Create a client using your Asana Personal Access Token: - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - -### OAuth 2 - -Asana supports OAuth 2. `asana` handles some of the details of the OAuth flow for you. - -Create a client using your OAuth Client ID and secret: - - client = asana.Client.oauth( - client_id='ASANA_CLIENT_ID', - client_secret='ASANA_CLIENT_SECRET', - redirect_uri='https://yourapp.com/auth/asana/callback' - ) - -Redirect the user to the authorization URL obtained from the client's `session` object: - - (url, state) = client.session.authorization_url() - -When the user is redirected back to your callback, check the `state` URL parameter matches, then pass the `code` parameter to obtain a bearer token: - - if request.params['state'] == state: - token = client.session.fetch_token(code=request.params['code']) - # ... - else: - # error! possible CSRF attack - -Note: if you're writing a non-browser-based application (e.x. a command line tool) you can use the special redirect URI `urn:ietf:wg:oauth:2.0:oob` to prompt the user to copy and paste the code into the application. - -Usage ------ - -The client's methods are divided into several resources: `attachments`, `events`, `jobs`, `portfolios`, `portfolio_memberships`, `projects`, `project_memberships`, `stories`, `tags`, `tasks`, `teams`, `users`, `user_task_lists`, and `workspaces`. - -Methods that return a single object return that object directly: - - me = client.users.get_user('me') - print(f'Hello {me['name']}') - - workspace_id = me['workspaces'][0]['gid'] - project = client.projects.create_in_workspace(workspace_id, { 'name': 'new project' }) - print(f'Created project with id: {project['gid']}') - -Methods that return multiple items (e.x. `get_tasks`, `get_projects`, `get_portfolios`, etc.) return a page iterator by default. See the "Collections" section. - -#### See [the gen folder](asana/resources/gen) for methods available for each resource. - -Options -------- - -Various options can be set globally on the `Client.DEFAULTS` object, per-client on `client.options`, or per-request as additional named arguments. For example: - - # global: - asana.Client.DEFAULT_OPTIONS['page_size'] = 100 - - # per-client: - client.options['page_size'] = 100 - - # per-request: - client.tasks.get_tasks({ 'project': 1234 }, page_size=100) - -### Available options - -* `base_url` (default: "https://app.asana.com/api/1.0"): API endpoint base URL to connect to -* `max_retries` (default: 5): number to times to retry if API rate limit is reached or a server error occures. Rate limit retries delay until the rate limit expires, server errors exponentially backoff starting with a 1 second delay. -* `full_payload` (default: False): return the entire JSON response instead of the 'data' propery (default for collection methods and `events.get`) -* `fields` and `expand`: see [API documentation](https://asana.com/developers/documentation/getting-started/input-output-options) - -Collections (methods returning an array as its 'data' property): - -* `iterator_type` (default: "items"): specifies which type of iterator (or not) to return. Valid values are "items" and `None`. -* `item_limit` (default: None): limits the number of items of a collection to return. -* `page_size` (default: 50): limits the number of items per page to fetch at a time. -* `offset`: offset token returned by previous calls to the same method (in `response['next_page']['offset']`) - -Events: - -* `poll_interval` (default: 5): polling interval for getting new events via `events.get_next` and `events.get_iterator` -* `sync`: sync token returned by previous calls to `events.get` (in `response['sync']`) - -### Asana Change Warnings - -You will receive warning logs if performing requests that may be affected by a deprecation. The warning contains a link that explains the deprecation. - -If you receive one of these warnings, you should: -* Read about the deprecation. -* Resolve sections of your code that would be affected by the deprecation. -* Add the deprecation flag to your "asana-enable" header. - -You can place it on the client for all requests, or place it on a single request. - - client.headers={'asana-enable': 'string_ids'} - or - me = client.users.get_user('me', headers={'asana-enable': 'string_ids'}) - -If you would rather suppress these warnings, you can set - - client.LOG_ASANA_CHANGE_WARNINGS = False - -Collections ------------ - -### Items Iterator - -By default, methods that return a collection of objects return an item iterator: - - workspaces = client.workspaces.get_workspaces(item_limit=1) - print(next(workspaces)) - print(next(workspaces)) # raises StopIteration if there are no more items - -Or: - - for workspace in client.workspaces.get_workspaces() - print(workspace) - -### Raw API - -You can also use the raw API to fetch a page at a time: - - offset = None - while True: - page = client.workspaces.get_workspaces(offset=offset, iterator_type=None, full_payload=True) - print(page['data']) - if 'next_page' in page and page['next_page']: - offset = page['next_page']['offset'] - else: - break - -Contributing ------------- - -Feel free to fork and submit pull requests for the code! Please follow the -existing code as an example of style and make sure that all your code passes -lint and tests. - -### Code generation - -The specific Asana resource classes under `gen` (`_Tag`, `_Workspace`, `_Task`, etc) are -generated code, hence they shouldn't be modified by hand. - -### Deployment - -**Repo Owners Only.** Take the following steps to issue a new release of the library. - -#### Automatic Deployment - -Run `deploy.py [major|minor|patch]`. See `deploy.py -h` for additional info. - -#### Manual Deployment - - 1. Merge in the desired changes into the `master` branch and commit them. - 2. Clone the repo, work on master. - 3. Edit package version in `asana/__init__.py` and `./VERSION` to indicate the [semantic version](http://semver.org/) change. - 4. Commit the change - 5. Tag the commit with `v` plus the same version number you set in the file. - `git tag v1.2.3` - 6. Push changes to origin, including tags: - `git push origin master --tags` - -GitHub Actions will automatically build and deploy the tagged release to [PyPI](https://pypi.org/). - -[github-actions-url]: https://github.com/Asana/python-asana/actions -[github-actions-image]: https://github.com/Asana/python-asana/workflows/Build/badge.svg - -[pypi-url]: https://pypi.python.org/pypi/asana/ -[pypi-image]: https://img.shields.io/pypi/v/asana.svg?style=flat-square - -[asana-docs]: https://developers.asana.com/docs diff --git a/TESTING b/TESTING deleted file mode 100644 index d1917e59..00000000 --- a/TESTING +++ /dev/null @@ -1,4 +0,0 @@ -Unit tests ----------- - - py.test tests diff --git a/VERSION b/VERSION deleted file mode 100644 index acf9bf09..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -3.2.2 \ No newline at end of file diff --git a/asana/__init__.py b/asana/__init__.py deleted file mode 100644 index 863b9d31..00000000 --- a/asana/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -__title__ = 'asana' -__license__ = 'MIT' -__copyright__ = 'Copyright 2016 Asana, Inc.' - -from asana.version import __version__ -from .client import Client diff --git a/asana/client.py b/asana/client.py deleted file mode 100644 index f72b1727..00000000 --- a/asana/client.py +++ /dev/null @@ -1,367 +0,0 @@ -from types import ModuleType -import json -import platform -import time -import string -import warnings - -import requests - -from . import error, resources, session, __version__ -from .page_iterator import CollectionPageIterator -import urllib.parse as urlparse - -# Create a dict of resource classes -RESOURCE_CLASSES = {} -for name, module in resources.__dict__.items(): - classified_name = string.capwords(name, '_').replace('_', '') - if classified_name == "BatchApi": - classified_name = "BatchAPI" - if classified_name == "AuditLogApi": - classified_name = "AuditLogAPI" - if isinstance(module, ModuleType) and classified_name in module.__dict__: - RESOURCE_CLASSES[name] = module.__dict__[classified_name] - -# Create a mapping of status codes to classes -STATUS_MAP = {} -for name, Klass in error.__dict__.items(): - if isinstance(Klass, type) and issubclass(Klass, error.AsanaError): - STATUS_MAP[Klass().status] = Klass - - -class Client(object): - """Asana client class""" - - DEFAULT_OPTIONS = { - 'base_url': 'https://app.asana.com/api/1.0', - 'item_limit': None, - 'page_size': 50, - 'poll_interval': 5, - 'max_retries': 5, - 'full_payload': False, - 'iterator_type': 'items' - } - - RETRY_DELAY = 1.0 - RETRY_BACKOFF = 2.0 - - CLIENT_OPTIONS = set(DEFAULT_OPTIONS.keys()) - QUERY_OPTIONS = {'limit', 'offset', 'sync'} - REQUEST_OPTIONS = {'headers', 'params', 'data', 'files', 'verify', - 'timeout'} - API_OPTIONS = {'pretty', 'fields', 'expand', 'client_name'} - - LOG_ASANA_CHANGE_WARNINGS = True - - ALL_OPTIONS = ( - CLIENT_OPTIONS | QUERY_OPTIONS | REQUEST_OPTIONS | API_OPTIONS) - - def __init__(self, session=None, auth=None, **options): - """A :class:`Client` object for interacting with Asana's API. - - A Client object with session, optional auth handler, and options. - - """ - self.session = session or requests.Session() - self.auth = auth - self.headers = options.pop('headers', {}) - # merge the provided options (if any) with the global DEFAULTS - self.options = _merge(self.DEFAULT_OPTIONS, options) - # intializes each resource, injecting this client object into the - # constructor - for name, Klass in RESOURCE_CLASSES.items(): - setattr(self, name, Klass(self)) - - def request(self, method, path, **options): - """Dispatches a request to the Asana HTTP API""" - options = self._merge_options(options) - url = options['base_url'] + path - retry_count = 0 - request_options = self._parse_request_options(options) - self._add_version_header(request_options) - while True: - try: - try: - response = getattr(self.session, method)( - url, auth=self.auth, **request_options) - except requests.exceptions.Timeout: - raise error.RetryableAsanaError() - - self._log_asana_change_header(request_options['headers'], response.headers) - if response.status_code in STATUS_MAP: - raise STATUS_MAP[response.status_code](response) - elif 500 <= response.status_code < 600: - # Any unhandled 500 is a server error. - raise error.ServerError(response) - else: - if options['full_payload']: - return response.json() - else: - return response.json()['data'] - except error.RetryableAsanaError as e: - if retry_count < options['max_retries']: - self._handle_retryable_error(e, retry_count) - retry_count += 1 - else: - raise e - - def _log_asana_change_header(self, req_headers, res_headers): - if self.LOG_ASANA_CHANGE_WARNINGS: - change_header_key = None - - for key in res_headers: - if key.lower() == 'asana-change': - change_header_key = key - - if change_header_key is not None: - accounted_for_flags = [] - - # Grab the request's asana-enable flags - for reqHeader in req_headers: - if reqHeader.lower() == 'asana-enable': - for flag in req_headers[reqHeader].split(','): - accounted_for_flags.append(flag) - elif reqHeader.lower() == 'asana-disable': - for flag in req_headers[reqHeader].split(','): - accounted_for_flags.append(flag) - - changes = res_headers[change_header_key].split(',') - - for unsplit_change in changes: - change = unsplit_change.split(';') - - name = None - info = None - affected = None - - for unsplit_field in change: - field = unsplit_field.split('=') - - field[0] = field[0].strip() - if field[0].strip() == 'name': - name = field[1].strip() - elif field[0].strip() == 'info': - info = field[1].strip() - elif field[0].strip() == 'affected': - affected = field[1].strip() - - # Only show the error if the flag was not in the request's asana-enable header - if (name not in accounted_for_flags) & (affected == 'true'): - message = 'This request is affected by the "' + name + \ - '" deprecation. Please visit this url for more info: ' + info + \ - '\n' + 'Adding "' + name + '" to your "Asana-Enable" or ' + \ - '"Asana-Disable" header will opt in/out to this deprecation ' + \ - 'and suppress this warning.' - - warnings.warn(message) - - - def _handle_retryable_error(self, e, retry_count): - """Sleep based on the type of :class:`RetryableAsanaError`""" - if isinstance(e, error.RateLimitEnforcedError): - time.sleep(e.retry_after) - else: - time.sleep(self.RETRY_DELAY * (self.RETRY_BACKOFF ** retry_count)) - - def get(self, path, query, **options): - """Parses GET request options and dispatches a request.""" - api_options = self._parse_api_options(options, query_string=True) - query_options = self._parse_query_options(options) - parameter_options = self._parse_parameter_options(options) - - # options in the query takes precendence - query = _merge(query_options, api_options, parameter_options, query) - return self.request('get', path, params=query, **options) - - def get_collection(self, path, query, **options): - """Get a collection from a collection endpoint. - - Parses GET request options for a collection endpoint and dispatches a - request. - - """ - options = self._merge_options(options) - if options['iterator_type'] == 'items': - return CollectionPageIterator(self, path, query, options).items() - if options['iterator_type'] is None: - return self.get(path, query, **options) - raise Exception('Unknown value for "iterator_type" option: {}'.format( - str(options['iterator_type']))) - - def post(self, path, data, **options): - """Parses POST request options and dispatches a request.""" - parameter_options = self._parse_parameter_options(options) - body = { - # values in the data body takes precendence - 'data': _merge(parameter_options, data), - 'options': self._parse_api_options(options) - } - headers = _merge( - {'content-type': 'application/json'}, - options.pop('headers', {}) - ) - return self.request('post', path, data=body, headers=headers, **options) - - def put(self, path, data, **options): - """Parses PUT request options and dispatches a request.""" - parameter_options = self._parse_parameter_options(options) - body = { - # values in the data body takes precendence - 'data': _merge(parameter_options, data), - 'options': self._parse_api_options(options) - } - headers = _merge( - {'content-type': 'application/json'}, - options.pop('headers', {}) - ) - return self.request('put', path, data=body, headers=headers, **options) - - def delete(self, path, data, **options): - """Dispatches a DELETE request.""" - return self.request('delete', path, **options) - - def _merge_options(self, *objects): - """Merge option objects with the client's object. - - Merges one or more options objects with client's options and returns a - new options object. - - """ - return _merge(self.options, *objects) - - def _parse_query_options(self, options): - """Select query string options out of the provided options object""" - return self._select_options(options, self.QUERY_OPTIONS) - - def _parse_parameter_options(self, options): - """Select all unknown options. - - Select all unknown options (not query string, API, or request - options) - - """ - return self._select_options(options, self.ALL_OPTIONS, invert=True) - - def _parse_api_options(self, options, query_string=False): - """Select API options out of the provided options object. - - Selects API string options out of the provided options object and - formats for either request body (default) or query string. - - """ - api_options = self._select_options(options, self.API_OPTIONS) - if query_string: - # Prefix all options with "opt_" - query_api_options = {} - for key in api_options: - # Transform list/tuples into comma separated list - if isinstance(api_options[key], (list, tuple)): - query_api_options[ - 'opt_' + key] = ','.join(api_options[key]) - else: - query_api_options[ - 'opt_' + key] = api_options[key] - return query_api_options - else: - return api_options - - def _parse_request_options(self, options): - """Select request options out of the provided options object. - - - Select and formats options to be passed to the 'requests' library's - request methods. - - """ - request_options = self._select_options(options, self.REQUEST_OPTIONS) - if 'params' in request_options: - params = request_options['params'] - for key in params: - if isinstance(params[key], bool): - params[key] = json.dumps(params[key]) - if 'data' in request_options: - # remove empty 'options': - if 'options' in request_options['data'] and ( - len(request_options['data']['options']) == 0): - del request_options['data']['options'] - # serialize 'data' to JSON, requests doesn't do this automatically: - request_options['data'] = json.dumps(request_options['data']) - - headers = self.headers.copy() - headers.update(request_options.get('headers', {})) - request_options['headers'] = headers - return request_options - - def _select_options(self, options, keys, invert=False): - """Select the provided keys out of an options object. - - - Selects the provided keys (or everything except the provided keys) out - of an options object. - - """ - options = self._merge_options(options) - result = {} - for key in options: - if (invert and key not in keys) or (not invert and key in keys): - result[key] = options[key] - return result - - def _add_version_header(self, options): - """Add the client lib version header to the request.""" - headers = options.setdefault('headers', {}) - headers['X-Asana-Client-Lib'] = self._version_header() - - _cached_version_header = None - - def _version_header(self): - """Generate the client version header to send on each request.""" - if not self._cached_version_header: - self._cached_version_header = urlparse.urlencode( - self._version_values()) - return self._cached_version_header - - def _version_values(self): - """Generate the values to go in the client version header.""" - return { - 'language': 'Python', - 'version': __version__, - 'language_version': platform.python_version(), - 'os': platform.system(), - 'os_version': platform.release() - } - - @classmethod - def basic_auth(Klass, apiKey): - """DEPRECATED: this is only present for backwards-compatibility. - - This will be removed in the future; for new apps, prefer the - `access_token` method. - - Construct an Asana Client using a Personal Access Token as if it - were an old (removed) Asana API Key. - """ - return Klass(auth=requests.auth.HTTPBasicAuth(apiKey, '')) - - @classmethod - def access_token(Klass, accessToken): - """Construct an Asana Client with a Personal Access Token""" - return Klass( - session.AsanaOAuth2Session(token={'access_token': accessToken})) - - @classmethod - def oauth(Klass, **kwargs): - """Construct an Asana Client with Oauth credentials. - - Construct an Asana Client with OAuth credentials ('client_id' and - 'client_secret' or 'token'). - - """ - return Klass(session.AsanaOAuth2Session(**kwargs)) - - -def _merge(*objects): - """Merge one or more objects into a new object""" - result = {} - [result.update(obj) for obj in objects] - return result diff --git a/asana/error.py b/asana/error.py deleted file mode 100644 index 71902f80..00000000 --- a/asana/error.py +++ /dev/null @@ -1,105 +0,0 @@ -class AsanaError(Exception): - """Base Asana error class""" - def __init__(self, message=None, status=None, response=None): - try: - messages = [ - error['message'] for error in response.json()['errors']] - message = message + ': ' + '; '.join(messages) - except Exception: - pass - - super(AsanaError, self).__init__(message) - - self.status = status - self.response = response - self.message = message - - -class InvalidRequestError(AsanaError): - def __init__(self, response=None): - super(InvalidRequestError, self).__init__( - message='Invalid Request', - status=400, - response=response - ) - - -class NoAuthorizationError(AsanaError): - def __init__(self, response=None): - super(NoAuthorizationError, self).__init__( - message='No Authorization', - status=401, - response=response - ) - - -class PremiumOnlyError(AsanaError): - def __init__(self, response=None): - super(PremiumOnlyError, self).__init__( - message='Payment Required', - status=402, - response=response - ) - - -class ForbiddenError(AsanaError): - def __init__(self, response=None): - super(ForbiddenError, self).__init__( - message='Forbidden', - status=403, - response=response - ) - - -class NotFoundError(AsanaError): - def __init__(self, response=None): - super(NotFoundError, self).__init__( - message='Not Found', - status=404, - response=response - ) - - -class InvalidTokenError(AsanaError): - def __init__(self, response=None): - super(InvalidTokenError, self).__init__( - message='Sync token invalid or too old', - status=412, - response=response - ) - self.sync = response is not None and response.json()['sync'] - - -class RetryableAsanaError(AsanaError): - """Base class for retryable errors. - - Base class for errors which should trigger a retry (if configured to do - so). - - """ - def __init__(self, message=None, status=None, response=None): - super(RetryableAsanaError, self).__init__( - message=message, status=status, response=response) - - -class RateLimitEnforcedError(RetryableAsanaError): - def __init__(self, response=None): - super(RateLimitEnforcedError, self).__init__( - message='Rate Limit Enforced', - status=429, - response=response - ) - self.retry_after = ( - response is not None and float(response.headers['Retry-After'])) - - -class ServerError(RetryableAsanaError): - def __init__(self, response=None): - status = 500 - if response: - status = response.status - super(ServerError, self).__init__( - message='Server Error', - status=status, - response=response - ) diff --git a/asana/page_iterator.py b/asana/page_iterator.py deleted file mode 100644 index 313c1d33..00000000 --- a/asana/page_iterator.py +++ /dev/null @@ -1,134 +0,0 @@ - -from .error import InvalidTokenError -import time - -class PageIterator(object): - """Generic page iterator class, used for collections and events""" - - def __init__(self, client, path, query, options): - self.client = client - self.path = path - self.query = query - self.options = client._merge_options(options, { 'full_payload': True }) - - self.item_limit = float('inf') if self.options.get('item_limit', None) == None else self.options['item_limit'] - self.page_size = self.options['page_size'] - self.count = 0 - - self.continuation = False - - def __getattr__(self, name): - """Getter for the custom named 'continuation' object.""" - if name == self.CONTINUATION_KEY: - return self.continuation - raise AttributeError("%r object has no attribute %r" % (self.__class__, attr)) - - def __iter__(self): - """Iterator interface, self is an iterator""" - return self - - def __next__(self): - """Iterator interface, returns the next 'page'""" - - # Compute the limit from the page size, and remaining item limit - self.options['limit'] = min(self.page_size, self.item_limit - self.count) - # If there is no continuation value or computed limit is 0, we're done - if self.continuation == None or self.options['limit'] == 0: - raise StopIteration - # First call to __next__ - elif self.continuation == False: - result = self.get_initial() - # Subsequent calls to __next__ - else: - result = self.get_next() - # Extract the continuation from the response - self.continuation = result.get(self.CONTINUATION_KEY, None) - # Get the data, update the count, return the data - data = result.get('data', None) - if data != None: - self.count += len(data) - return data - - def next(self): - """Alias for __next__""" - return self.__next__() - - def items(self): - """Returns an iterator for each item in each page""" - for page in self: - for item in page: - yield item - - -class CollectionPageIterator(PageIterator): - """Iterator that returns one page of a collection at a time""" - - CONTINUATION_KEY = 'next_page' - - def get_initial(self): - return self.client.get(self.path, self.query, **self.options) - - def get_next(self): - self.options['offset'] = self.continuation['offset'] - return self.client.get(self.path, self.query, **self.options) - - -class EventsPageIterator(PageIterator): - """Iterator that returns the next page of events, polls until a non-empty page is returned""" - - CONTINUATION_KEY = 'sync' - - def get_initial(self): - # If no sync token was provided, make a request to get one - if 'sync' not in self.query: - try: - self.client.events.get(self.query, **self.options) - except InvalidTokenError as e: - # InvalidTokenError is expected to be thrown since we didn't provide a sync token - self.continuation = e.sync - else: - self.continuation = self.query['sync'] - return self.get_next() - - def get_next(self): - self.query['sync'] = self.continuation - return self.client.events.get(self.query, **self.options) - - def __next__(self): - # Override __next__ to continue polling until a non-empty page of events is returned - while True: - results = super(EventsPageIterator, self).__next__() - if len(results) > 0: - return results - else: - time.sleep(self.options['poll_interval']) - - -class AuditLogAPIIterator(CollectionPageIterator): - """Iterator that returns the next page of audit_log_api""" - - def __next__(self): - """Override __next__ to stop when there is no more data""" - - # Compute the limit from the page size, and remaining item limit - self.options['limit'] = min( - self.page_size, self.item_limit - self.count) - # If there is no continuation value or computed limit is 0, we're done - if self.continuation == None or self.options['limit'] == 0: - raise StopIteration - # First call to __next__ - elif self.continuation == False: - result = self.get_initial() - # Subsequent calls to __next__ - else: - result = self.get_next() - # Extract the continuation from the response - self.continuation = result.get(self.CONTINUATION_KEY, None) - # Get the data - data = result.get('data', None) - # If there is no more data we're done. Otherwise, we update the count and return the data - if not data: - raise StopIteration - else: - self.count += len(data) - return data diff --git a/asana/resources/__init__.py b/asana/resources/__init__.py deleted file mode 100644 index 58f3953f..00000000 --- a/asana/resources/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -from . import ( - attachments, - audit_log_api, - batch_api, - custom_field_settings, - custom_fields, - events, - goal_relationships, - goals, - jobs, - memberships, - message, - organization_exports, - portfolios, - portfolio_memberships, - project_briefs, - project_memberships, - project_statuses, - project_templates, - projects, - sections, - status_updates, - stories, - tags, - tasks, - teams, - time_periods, - team_memberships, - typeahead, - users, - user_task_lists, - webhooks, - workspace_memberships, - workspaces -) diff --git a/asana/resources/attachments.py b/asana/resources/attachments.py deleted file mode 100644 index 9d44ddde..00000000 --- a/asana/resources/attachments.py +++ /dev/null @@ -1,36 +0,0 @@ - -from .gen.attachments import _Attachments - -class Attachments(_Attachments): - """Attachments resource""" - - def create_attachment_for_task(self, task_id, file_content, file_name, file_content_type=None, **options): - """Upload an attachment for a task. Accepts a file object or string, file name, and optional file Content-Type""" - path = '/tasks/%s/attachments' % (task_id) - return self.client.request('post', path, files=[('file', (file_name, file_content, file_content_type))], **options) - - def create_on_task(self, task_id, file_content, file_name, file_content_type=None, **options): - path = '/tasks/%s/attachments' % (task_id) - return self.client.request('post', path, files=[('file', (file_name, file_content, file_content_type))], **options) - - def find_by_id(self, attachment, params={}, **options): - """Returns the full record for a single attachment. - - Parameters - ---------- - attachment : {Gid} Globally unique identifier for the attachment. - [params] : {Object} Parameters for the request - """ - path = "/attachments/%s" % (attachment) - return self.client.get(path, params, **options) - - def find_by_task(self, task, params={}, **options): - """Returns the compact records for all attachments on the task. - - Parameters - ---------- - task : {Gid} Globally unique identifier for the task. - [params] : {Object} Parameters for the request - """ - path = "/tasks/%s/attachments" % (task) - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/audit_log_api.py b/asana/resources/audit_log_api.py deleted file mode 100644 index 43c3e30f..00000000 --- a/asana/resources/audit_log_api.py +++ /dev/null @@ -1,19 +0,0 @@ - -from .gen.audit_log_api import _AuditLogAPI -from ..page_iterator import AuditLogAPIIterator - - -class AuditLogAPI(_AuditLogAPI): - """AuditLogAPI resource""" - - def get_audit_log_events(self, workspace_gid, params={}, **options): - """Override get_audit_log_events to handle non-empty next_page parameter""" - path = "/workspaces/{workspace_gid}/audit_log_events".replace( - "{workspace_gid}", workspace_gid) - options = self.client._merge_options(options) - if options['iterator_type'] == 'items': - return AuditLogAPIIterator(self.client, path, params, options).items() - if options['iterator_type'] is None: - return self.client.get(path, params, **options) - raise Exception('Unknown value for "iterator_type" option: {}'.format( - str(options['iterator_type']))) diff --git a/asana/resources/batch_api.py b/asana/resources/batch_api.py deleted file mode 100644 index c9f1954a..00000000 --- a/asana/resources/batch_api.py +++ /dev/null @@ -1,6 +0,0 @@ - -from .gen.batch_api import _BatchAPI - -class BatchAPI(_BatchAPI): - """BatchAPI resource""" - pass diff --git a/asana/resources/custom_field_settings.py b/asana/resources/custom_field_settings.py deleted file mode 100644 index e524ba29..00000000 --- a/asana/resources/custom_field_settings.py +++ /dev/null @@ -1,26 +0,0 @@ - -from .gen.custom_field_settings import _CustomFieldSettings - -class CustomFieldSettings(_CustomFieldSettings): - """Custom Field Settings resource""" - def find_by_project(self, project, params={}, **options): - """Returns a list of all of the custom fields settings on a project. - - Parameters - ---------- - project : {Gid} The ID of the project for which to list custom field settings - [params] : {Object} Parameters for the request - """ - path = "/projects/%s/custom_field_settings" % (project) - return self.client.get_collection(path, params, **options) - - def find_by_portfolio(self, portfolio, params={}, **options): - """Returns a list of all of the custom fields settings on a portfolio. - - Parameters - ---------- - portfolio : {Gid} The ID of the portfolio for which to list custom field settings - [params] : {Object} Parameters for the request - """ - path = "/portfolios/%s/custom_field_settings" % (portfolio) - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/custom_fields.py b/asana/resources/custom_fields.py deleted file mode 100644 index 45008c36..00000000 --- a/asana/resources/custom_fields.py +++ /dev/null @@ -1,140 +0,0 @@ - -from .gen.custom_fields import _CustomFields - -class CustomFields(_CustomFields): - """Custom Fields resource""" - def add_enum_option(self, custom_field, params={}, **options): - self.create_enum_option(custom_field, params, **options) - - def reorder_enum_option(self, custom_field, params={}, **options): - self.insert_enum_option(custom_field, params, **options) - - def create(self, params={}, **options): - """Creates a new custom field in a workspace. Every custom field is required to be created in a specific workspace, and this workspace cannot be changed once set. - - A custom field's `name` must be unique within a workspace and not conflict with names of existing task properties such as 'Due Date' or 'Assignee'. A custom field's `type` must be one of 'text', 'enum', or 'number'. - - Returns the full record of the newly created custom field. - - Parameters - ---------- - [data] : {Object} Data for the request - - workspace : {Gid} The workspace to create a custom field in. - - resource_subtype : {String} The type of the custom field. Must be one of the given values. - - [type] : {String} **Deprecated: New integrations should prefer the `resource_subtype` parameter.** - - name : {String} The name of the custom field. - - [description] : {String} The description of the custom field. - - [precision] : {Integer} The number of decimal places for the numerical values. Required if the custom field is of type 'number'. - - [enum_options] : {String} The discrete values the custom field can assume. Required if the custom field is of type 'enum'. - """ - return self.client.post("/custom_fields", params, **options) - - def find_by_id(self, custom_field, params={}, **options): - """Returns the complete definition of a custom field's metadata. - - Parameters - ---------- - custom_field : {Gid} Globally unique identifier for the custom field. - [params] : {Object} Parameters for the request - """ - path = "/custom_fields/%s" % (custom_field) - return self.client.get(path, params, **options) - - def find_by_workspace(self, workspace, params={}, **options): - """Returns a list of the compact representation of all of the custom fields in a workspace. - - Parameters - ---------- - workspace : {Gid} The workspace or organization to find custom field definitions in. - [params] : {Object} Parameters for the request - """ - path = "/workspaces/%s/custom_fields" % (workspace) - return self.client.get_collection(path, params, **options) - - def update(self, custom_field, params={}, **options): - """A specific, existing custom field can be updated by making a PUT request on the URL for that custom field. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged - - When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the custom field. - - An enum custom field's `enum_options` cannot be updated with this endpoint. Instead see "Work With Enum Options" for information on how to update `enum_options`. - - Locked custom fields can only be updated by the user who locked the field. - - Returns the complete updated custom field record. - - Parameters - ---------- - custom_field : {Gid} Globally unique identifier for the custom field. - [data] : {Object} Data for the request - """ - path = "/custom_fields/%s" % (custom_field) - return self.client.put(path, params, **options) - - def delete(self, custom_field, params={}, **options): - """A specific, existing custom field can be deleted by making a DELETE request on the URL for that custom field. - - Locked custom fields can only be deleted by the user who locked the field. - - Returns an empty data record. - - Parameters - ---------- - custom_field : {Gid} Globally unique identifier for the custom field. - """ - path = "/custom_fields/%s" % (custom_field) - return self.client.delete(path, params, **options) - - def create_enum_option(self, custom_field, params={}, **options): - """Creates an enum option and adds it to this custom field's list of enum options. A custom field can have at most 50 enum options (including disabled options). By default new enum options are inserted at the end of a custom field's list. - - Locked custom fields can only have enum options added by the user who locked the field. - - Returns the full record of the newly created enum option. - - Parameters - ---------- - custom_field : {Gid} Globally unique identifier for the custom field. - [data] : {Object} Data for the request - - name : {String} The name of the enum option. - - [color] : {String} The color of the enum option. Defaults to 'none'. - - [insert_before] : {Gid} An existing enum option within this custom field before which the new enum option should be inserted. Cannot be provided together with after_enum_option. - - [insert_after] : {Gid} An existing enum option within this custom field after which the new enum option should be inserted. Cannot be provided together with before_enum_option. - """ - path = "/custom_fields/%s/enum_options" % (custom_field) - return self.client.post(path, params, **options) - - def update_enum_option(self, enum_option, params={}, **options): - """Updates an existing enum option. Enum custom fields require at least one enabled enum option. - - Locked custom fields can only be updated by the user who locked the field. - - Returns the full record of the updated enum option. - - Parameters - ---------- - enum_option : {Gid} Globally unique identifier for the enum option. - [data] : {Object} Data for the request - - name : {String} The name of the enum option. - - [color] : {String} The color of the enum option. Defaults to 'none'. - - [enabled] : {Boolean} Whether or not the enum option is a selectable value for the custom field. - """ - path = "/enum_options/%s" % (enum_option) - return self.client.put(path, params, **options) - - def insert_enum_option(self, custom_field, params={}, **options): - """Moves a particular enum option to be either before or after another specified enum option in the custom field. - - Locked custom fields can only be reordered by the user who locked the field. - - Parameters - ---------- - custom_field : {Gid} Globally unique identifier for the custom field. - [data] : {Object} Data for the request - - enum_option : {Gid} The ID of the enum option to relocate. - - name : {String} The name of the enum option. - - [color] : {String} The color of the enum option. Defaults to 'none'. - - [before_enum_option] : {Gid} An existing enum option within this custom field before which the new enum option should be inserted. Cannot be provided together with after_enum_option. - - [after_enum_option] : {Gid} An existing enum option within this custom field after which the new enum option should be inserted. Cannot be provided together with before_enum_option. - """ - path = "/custom_fields/%s/enum_options/insert" % (custom_field) - return self.client.post(path, params, **options) diff --git a/asana/resources/events.py b/asana/resources/events.py deleted file mode 100644 index dc1643ac..00000000 --- a/asana/resources/events.py +++ /dev/null @@ -1,22 +0,0 @@ - -from .gen.events import _Events -from ..error import InvalidTokenError -from ..page_iterator import EventsPageIterator - -class Events(_Events): - """Events resource""" - - def get(self, params, **options): - """Dispatches a GET request to /events of the API to get a set of recent changes to a resource.""" - options = self.client._merge_options({ 'full_payload': True }) - return self.client.get('/events', params, **options) - - def get_next(self, query, **options): - """Returns a tuple containing the next page of events and a sync token for the given query (and optional 'sync' token)""" - iterator = EventsPageIterator(self.client, '/events', query, options) - result = next(iterator) - return (result, iterator.sync) - - def get_iterator(self, query, **options): - """Returns an event iterator for the given query (and optional 'sync' token)""" - return EventsPageIterator(self.client, '/events', query, options).items() diff --git a/asana/resources/gen/__init__.py b/asana/resources/gen/__init__.py deleted file mode 100644 index 2786f20b..00000000 --- a/asana/resources/gen/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -from . import ( - attachments, - audit_log_api, - batch_api, - custom_field_settings, - custom_fields, - events, - goals, - jobs, - organization_exports, - portfolios, - portfolio_memberships, - project_briefs, - project_memberships, - project_statuses, - project_templates, - projects, - sections, - status_updates, - stories, - tags, - tasks, - team_memberships, - teams, - time_periods, - typeahead, - users, - user_task_lists, - webhooks, - workspace_memberships, - workspaces -) diff --git a/asana/resources/gen/attachments.py b/asana/resources/gen/attachments.py deleted file mode 100644 index cb5f2998..00000000 --- a/asana/resources/gen/attachments.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -class _Attachments: - - def __init__(self, client=None): - self.client = client - - def delete_attachment(self, attachment_gid, params=None, **options): - """Delete an attachment - :param str attachment_gid: (required) Globally unique identifier for the attachment. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/attachments/{attachment_gid}".replace("{attachment_gid}", attachment_gid) - return self.client.delete(path, params, **options) - - def get_attachment(self, attachment_gid, params=None, **options): - """Get an attachment - :param str attachment_gid: (required) Globally unique identifier for the attachment. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/attachments/{attachment_gid}".replace("{attachment_gid}", attachment_gid) - return self.client.get(path, params, **options) - - def get_attachments_for_object(self, params=None, **options): - """Get attachments from an object - :param Object params: Parameters for the request - - parent {str}: (required) Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/attachments" - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/audit_log_api.py b/asana/resources/gen/audit_log_api.py deleted file mode 100644 index 36c81cc3..00000000 --- a/asana/resources/gen/audit_log_api.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -class _AuditLogAPI: - - def __init__(self, client=None): - self.client = client - - def get_audit_log_events(self, workspace_gid, params=None, **options): - """Get audit log events - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - - start_at {datetime}: Filter to events created after this time (inclusive). - - end_at {datetime}: Filter to events created before this time (exclusive). - - event_type {str}: Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values. - - actor_type {str}: Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded. - - actor_gid {str}: Filter to events triggered by the actor with this ID. - - resource_gid {str}: Filter to events with this resource ID. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/audit_log_events".replace("{workspace_gid}", workspace_gid) - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/batch_api.py b/asana/resources/gen/batch_api.py deleted file mode 100644 index 3652b3d3..00000000 --- a/asana/resources/gen/batch_api.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 -class _BatchAPI: - - def __init__(self, client=None): - self.client = client - - def create_batch_request(self, params=None, **options): - """Submit parallel requests - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/batch" - return self.client.post(path, params, **options) diff --git a/asana/resources/gen/custom_field_settings.py b/asana/resources/gen/custom_field_settings.py deleted file mode 100644 index 563a68c3..00000000 --- a/asana/resources/gen/custom_field_settings.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -class _CustomFieldSettings: - - def __init__(self, client=None): - self.client = client - - def get_custom_field_settings_for_portfolio(self, portfolio_gid, params=None, **options): - """Get a portfolio's custom fields - :param str portfolio_gid: (required) Globally unique identifier for the portfolio. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios/{portfolio_gid}/custom_field_settings".replace("{portfolio_gid}", portfolio_gid) - return self.client.get_collection(path, params, **options) - - def get_custom_field_settings_for_project(self, project_gid, params=None, **options): - """Get a project's custom fields - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/custom_field_settings".replace("{project_gid}", project_gid) - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/custom_fields.py b/asana/resources/gen/custom_fields.py deleted file mode 100644 index ba1a673e..00000000 --- a/asana/resources/gen/custom_fields.py +++ /dev/null @@ -1,122 +0,0 @@ -# coding=utf-8 -class _CustomFields: - - def __init__(self, client=None): - self.client = client - - def create_custom_field(self, params=None, **options): - """Create a custom field - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/custom_fields" - return self.client.post(path, params, **options) - - def create_enum_option_for_custom_field(self, custom_field_gid, params=None, **options): - """Create an enum option - :param str custom_field_gid: (required) Globally unique identifier for the custom field. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/custom_fields/{custom_field_gid}/enum_options".replace("{custom_field_gid}", custom_field_gid) - return self.client.post(path, params, **options) - - def delete_custom_field(self, custom_field_gid, params=None, **options): - """Delete a custom field - :param str custom_field_gid: (required) Globally unique identifier for the custom field. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/custom_fields/{custom_field_gid}".replace("{custom_field_gid}", custom_field_gid) - return self.client.delete(path, params, **options) - - def get_custom_field(self, custom_field_gid, params=None, **options): - """Get a custom field - :param str custom_field_gid: (required) Globally unique identifier for the custom field. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/custom_fields/{custom_field_gid}".replace("{custom_field_gid}", custom_field_gid) - return self.client.get(path, params, **options) - - def get_custom_fields_for_workspace(self, workspace_gid, params=None, **options): - """Get a workspace's custom fields - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/custom_fields".replace("{workspace_gid}", workspace_gid) - return self.client.get_collection(path, params, **options) - - def insert_enum_option_for_custom_field(self, custom_field_gid, params=None, **options): - """Reorder a custom field's enum - :param str custom_field_gid: (required) Globally unique identifier for the custom field. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/custom_fields/{custom_field_gid}/enum_options/insert".replace("{custom_field_gid}", custom_field_gid) - return self.client.post(path, params, **options) - - def update_custom_field(self, custom_field_gid, params=None, **options): - """Update a custom field - :param str custom_field_gid: (required) Globally unique identifier for the custom field. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/custom_fields/{custom_field_gid}".replace("{custom_field_gid}", custom_field_gid) - return self.client.put(path, params, **options) - - def update_enum_option(self, enum_option_gid, params=None, **options): - """Update an enum option - :param str enum_option_gid: (required) Globally unique identifier for the enum option. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/enum_options/{enum_option_gid}".replace("{enum_option_gid}", enum_option_gid) - return self.client.put(path, params, **options) diff --git a/asana/resources/gen/events.py b/asana/resources/gen/events.py deleted file mode 100644 index 5ba54075..00000000 --- a/asana/resources/gen/events.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -class _Events: - - def __init__(self, client=None): - self.client = client - - def get_events(self, params=None, **options): - """Get events on a resource - :param Object params: Parameters for the request - - resource {str}: (required) A resource ID to subscribe to. The resource can be a task or project. - - sync {str}: A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.* - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/events" - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/goal_relationships.py b/asana/resources/gen/goal_relationships.py deleted file mode 100644 index e5ee197c..00000000 --- a/asana/resources/gen/goal_relationships.py +++ /dev/null @@ -1,76 +0,0 @@ -# coding=utf-8 -class _GoalRelationships: - - def __init__(self, client=None): - self.client = client - - def add_supporting_relationship(self, goal_gid, params=None, **options): - """Add a supporting goal relationship - :param str goal_gid: (required) Globally unique identifier for the goal. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goals/{goal_gid}/addSupportingRelationship".replace("{goal_gid}", goal_gid) - return self.client.post(path, params, **options) - - def get_goal_relationship(self, goal_relationship_gid, params=None, **options): - """Get a goal relationship - :param str goal_relationship_gid: (required) Globally unique identifier for the goal relationship. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goal_relationships/{goal_relationship_gid}".replace("{goal_relationship_gid}", goal_relationship_gid) - return self.client.get(path, params, **options) - - def get_goal_relationships(self, params=None, **options): - """Get goal relationships - :param Object params: Parameters for the request - - supported_goal {str}: (required) Globally unique identifier for the supported goal in the goal relationship. - - resource_subtype {str}: If provided, filter to goal relationships with a given resource_subtype. - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goal_relationships" - return self.client.get_collection(path, params, **options) - - def remove_supporting_relationship(self, goal_gid, params=None, **options): - """Removes a supporting goal relationship - :param str goal_gid: (required) Globally unique identifier for the goal. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goals/{goal_gid}/removeSupportingRelationship".replace("{goal_gid}", goal_gid) - return self.client.post(path, params, **options) - - def update_goal_relationship(self, goal_relationship_gid, params=None, **options): - """Update a goal relationship - :param str goal_relationship_gid: (required) Globally unique identifier for the goal relationship. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goal_relationships/{goal_relationship_gid}".replace("{goal_relationship_gid}", goal_relationship_gid) - return self.client.put(path, params, **options) diff --git a/asana/resources/gen/goals.py b/asana/resources/gen/goals.py deleted file mode 100644 index 79e47743..00000000 --- a/asana/resources/gen/goals.py +++ /dev/null @@ -1,153 +0,0 @@ -# coding=utf-8 -class _Goals: - - def __init__(self, client=None): - self.client = client - - def add_followers(self, goal_gid, params=None, **options): - """Add a collaborator to a goal - :param str goal_gid: (required) Globally unique identifier for the goal. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goals/{goal_gid}/addFollowers".replace("{goal_gid}", goal_gid) - return self.client.post(path, params, **options) - - def create_goal(self, params=None, **options): - """Create a goal - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goals" - return self.client.post(path, params, **options) - - def create_goal_metric(self, goal_gid, params=None, **options): - """Create a goal metric - :param str goal_gid: (required) Globally unique identifier for the goal. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goals/{goal_gid}/setMetric".replace("{goal_gid}", goal_gid) - return self.client.post(path, params, **options) - - def delete_goal(self, goal_gid, params=None, **options): - """Delete a goal - :param str goal_gid: (required) Globally unique identifier for the goal. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goals/{goal_gid}".replace("{goal_gid}", goal_gid) - return self.client.delete(path, params, **options) - - def get_goal(self, goal_gid, params=None, **options): - """Get a goal - :param str goal_gid: (required) Globally unique identifier for the goal. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goals/{goal_gid}".replace("{goal_gid}", goal_gid) - return self.client.get(path, params, **options) - - def get_goals(self, params=None, **options): - """Get goals - :param Object params: Parameters for the request - - portfolio {str}: Globally unique identifier for supporting portfolio. - - project {str}: Globally unique identifier for supporting project. - - is_workspace_level {bool}: Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter. - - team {str}: Globally unique identifier for the team. - - workspace {str}: Globally unique identifier for the workspace. - - time_periods {list[str]}: Globally unique identifiers for the time periods. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goals" - return self.client.get_collection(path, params, **options) - - def get_parent_goals_for_goal(self, goal_gid, params=None, **options): - """Get parent goals from a goal - :param str goal_gid: (required) Globally unique identifier for the goal. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goals/{goal_gid}/parentGoals".replace("{goal_gid}", goal_gid) - return self.client.get_collection(path, params, **options) - - def remove_followers(self, goal_gid, params=None, **options): - """Remove a collaborator from a goal - :param str goal_gid: (required) Globally unique identifier for the goal. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goals/{goal_gid}/removeFollowers".replace("{goal_gid}", goal_gid) - return self.client.post(path, params, **options) - - def update_goal(self, goal_gid, params=None, **options): - """Update a goal - :param str goal_gid: (required) Globally unique identifier for the goal. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goals/{goal_gid}".replace("{goal_gid}", goal_gid) - return self.client.put(path, params, **options) - - def update_goal_metric(self, goal_gid, params=None, **options): - """Update a goal metric - :param str goal_gid: (required) Globally unique identifier for the goal. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/goals/{goal_gid}/setMetricCurrentValue".replace("{goal_gid}", goal_gid) - return self.client.post(path, params, **options) diff --git a/asana/resources/gen/jobs.py b/asana/resources/gen/jobs.py deleted file mode 100644 index 2c1d7027..00000000 --- a/asana/resources/gen/jobs.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -class _Jobs: - - def __init__(self, client=None): - self.client = client - - def get_job(self, job_gid, params=None, **options): - """Get a job by id - :param str job_gid: (required) Globally unique identifier for the job. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/jobs/{job_gid}".replace("{job_gid}", job_gid) - return self.client.get(path, params, **options) diff --git a/asana/resources/gen/memberships.py b/asana/resources/gen/memberships.py deleted file mode 100644 index 64a222a9..00000000 --- a/asana/resources/gen/memberships.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -class _Memberships: - - def __init__(self, client=None): - self.client = client - - def create_membership(self, params=None, **options): - """Create a membership - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/memberships" - return self.client.post(path, params, **options) - - def delete_membership(self, membership_gid, params=None, **options): - """Delete a membership - :param str membership_gid: (required) Globally unique identifier for the membership. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/memberships/{membership_gid}".replace("{membership_gid}", membership_gid) - return self.client.delete(path, params, **options) - - def get_memberships(self, params=None, **options): - """Get multiple memberships - :param Object params: Parameters for the request - - parent {str}: Globally unique identifier for `project`, `portfolio`, `team`, `goal`, and `workspace`. - - member {str}: Globally unique identifier for `team` or `user`. - - resource_subtype {str}: The resource_subtype to filter on. Must be provided with `member` and `workspace` if `parent` is not provided. Valid values include `team_membership`, `workspace_membership`, `portfolio_membership` - - workspace {str}: The workspace to filter on. Must be provided with `member` and `resource_subtype` if `parent` is not provided. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Pagination limit for the request. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/memberships" - return self.client.get_collection(path, params, **options) - - def update_membership(self, membership_gid, params=None, **options): - """Update a membership - :param str membership_gid: (required) Globally unique identifier for the membership. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/memberships/{membership_gid}".replace("{membership_gid}", membership_gid) - return self.client.put(path, params, **options) diff --git a/asana/resources/gen/message.py b/asana/resources/gen/message.py deleted file mode 100644 index 13791545..00000000 --- a/asana/resources/gen/message.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -class _Message: - - def __init__(self, client=None): - self.client = client - - def get_message(self, message_gid, params=None, **options): - """Get a message - :param str message_gid: (required) The message to get. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/messages/{message_gid}".replace("{message_gid}", message_gid) - return self.client.get(path, params, **options) diff --git a/asana/resources/gen/organization_exports.py b/asana/resources/gen/organization_exports.py deleted file mode 100644 index 0c196941..00000000 --- a/asana/resources/gen/organization_exports.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -class _OrganizationExports: - - def __init__(self, client=None): - self.client = client - - def create_organization_export(self, params=None, **options): - """Create an organization export request - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/organization_exports" - return self.client.post(path, params, **options) - - def get_organization_export(self, organization_export_gid, params=None, **options): - """Get details on an org export request - :param str organization_export_gid: (required) Globally unique identifier for the organization export. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/organization_exports/{organization_export_gid}".replace("{organization_export_gid}", organization_export_gid) - return self.client.get(path, params, **options) diff --git a/asana/resources/gen/portfolio_memberships.py b/asana/resources/gen/portfolio_memberships.py deleted file mode 100644 index bbae489d..00000000 --- a/asana/resources/gen/portfolio_memberships.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding=utf-8 -class _PortfolioMemberships: - - def __init__(self, client=None): - self.client = client - - def get_portfolio_membership(self, portfolio_membership_gid, params=None, **options): - """Get a portfolio membership - :param str portfolio_membership_gid: (required) - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolio_memberships/{portfolio_membership_gid}".replace("{portfolio_membership_gid}", portfolio_membership_gid) - return self.client.get(path, params, **options) - - def get_portfolio_memberships(self, params=None, **options): - """Get multiple portfolio memberships - :param Object params: Parameters for the request - - portfolio {str}: The portfolio to filter results on. - - workspace {str}: The workspace to filter results on. - - user {str}: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolio_memberships" - return self.client.get_collection(path, params, **options) - - def get_portfolio_memberships_for_portfolio(self, portfolio_gid, params=None, **options): - """Get memberships from a portfolio - :param str portfolio_gid: (required) Globally unique identifier for the portfolio. - :param Object params: Parameters for the request - - user {str}: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios/{portfolio_gid}/portfolio_memberships".replace("{portfolio_gid}", portfolio_gid) - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/portfolios.py b/asana/resources/gen/portfolios.py deleted file mode 100644 index 5ec3d557..00000000 --- a/asana/resources/gen/portfolios.py +++ /dev/null @@ -1,175 +0,0 @@ -# coding=utf-8 -class _Portfolios: - - def __init__(self, client=None): - self.client = client - - def add_custom_field_setting_for_portfolio(self, portfolio_gid, params=None, **options): - """Add a custom field to a portfolio - :param str portfolio_gid: (required) Globally unique identifier for the portfolio. - :param Object params: Parameters for the request - :param **options - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios/{portfolio_gid}/addCustomFieldSetting".replace("{portfolio_gid}", portfolio_gid) - return self.client.post(path, params, **options) - - def add_item_for_portfolio(self, portfolio_gid, params=None, **options): - """Add a portfolio item - :param str portfolio_gid: (required) Globally unique identifier for the portfolio. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios/{portfolio_gid}/addItem".replace("{portfolio_gid}", portfolio_gid) - return self.client.post(path, params, **options) - - def add_members_for_portfolio(self, portfolio_gid, params=None, **options): - """Add users to a portfolio - :param str portfolio_gid: (required) Globally unique identifier for the portfolio. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios/{portfolio_gid}/addMembers".replace("{portfolio_gid}", portfolio_gid) - return self.client.post(path, params, **options) - - def create_portfolio(self, params=None, **options): - """Create a portfolio - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios" - return self.client.post(path, params, **options) - - def delete_portfolio(self, portfolio_gid, params=None, **options): - """Delete a portfolio - :param str portfolio_gid: (required) Globally unique identifier for the portfolio. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios/{portfolio_gid}".replace("{portfolio_gid}", portfolio_gid) - return self.client.delete(path, params, **options) - - def get_items_for_portfolio(self, portfolio_gid, params=None, **options): - """Get portfolio items - :param str portfolio_gid: (required) Globally unique identifier for the portfolio. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios/{portfolio_gid}/items".replace("{portfolio_gid}", portfolio_gid) - return self.client.get_collection(path, params, **options) - - def get_portfolio(self, portfolio_gid, params=None, **options): - """Get a portfolio - :param str portfolio_gid: (required) Globally unique identifier for the portfolio. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios/{portfolio_gid}".replace("{portfolio_gid}", portfolio_gid) - return self.client.get(path, params, **options) - - def get_portfolios(self, params=None, **options): - """Get multiple portfolios - :param Object params: Parameters for the request - - workspace {str}: (required) The workspace or organization to filter portfolios on. - - owner {str}: The user who owns the portfolio. Currently, API users can only get a list of portfolios that they themselves own. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios" - return self.client.get_collection(path, params, **options) - - def remove_custom_field_setting_for_portfolio(self, portfolio_gid, params=None, **options): - """Remove a custom field from a portfolio - :param str portfolio_gid: (required) Globally unique identifier for the portfolio. - :param Object params: Parameters for the request - :param **options - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios/{portfolio_gid}/removeCustomFieldSetting".replace("{portfolio_gid}", portfolio_gid) - return self.client.post(path, params, **options) - - def remove_item_for_portfolio(self, portfolio_gid, params=None, **options): - """Remove a portfolio item - :param str portfolio_gid: (required) Globally unique identifier for the portfolio. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios/{portfolio_gid}/removeItem".replace("{portfolio_gid}", portfolio_gid) - return self.client.post(path, params, **options) - - def remove_members_for_portfolio(self, portfolio_gid, params=None, **options): - """Remove users from a portfolio - :param str portfolio_gid: (required) Globally unique identifier for the portfolio. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios/{portfolio_gid}/removeMembers".replace("{portfolio_gid}", portfolio_gid) - return self.client.post(path, params, **options) - - def update_portfolio(self, portfolio_gid, params=None, **options): - """Update a portfolio - :param str portfolio_gid: (required) Globally unique identifier for the portfolio. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/portfolios/{portfolio_gid}".replace("{portfolio_gid}", portfolio_gid) - return self.client.put(path, params, **options) diff --git a/asana/resources/gen/project_briefs.py b/asana/resources/gen/project_briefs.py deleted file mode 100644 index 4d59ff55..00000000 --- a/asana/resources/gen/project_briefs.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -class _ProjectBriefs: - - def __init__(self, client=None): - self.client = client - - def create_project_brief(self, project_gid, params=None, **options): - """Create a project brief - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/project_briefs".replace("{project_gid}", project_gid) - return self.client.post(path, params, **options) - - def delete_project_brief(self, project_brief_gid, params=None, **options): - """Delete a project brief - :param str project_brief_gid: (required) Globally unique identifier for the project brief. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/project_briefs/{project_brief_gid}".replace("{project_brief_gid}", project_brief_gid) - return self.client.delete(path, params, **options) - - def get_project_brief(self, project_brief_gid, params=None, **options): - """Get a project brief - :param str project_brief_gid: (required) Globally unique identifier for the project brief. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/project_briefs/{project_brief_gid}".replace("{project_brief_gid}", project_brief_gid) - return self.client.get(path, params, **options) - - def update_project_brief(self, project_brief_gid, params=None, **options): - """Update a project brief - :param str project_brief_gid: (required) Globally unique identifier for the project brief. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/project_briefs/{project_brief_gid}".replace("{project_brief_gid}", project_brief_gid) - return self.client.put(path, params, **options) diff --git a/asana/resources/gen/project_memberships.py b/asana/resources/gen/project_memberships.py deleted file mode 100644 index a78c0af5..00000000 --- a/asana/resources/gen/project_memberships.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -class _ProjectMemberships: - - def __init__(self, client=None): - self.client = client - - def get_project_membership(self, project_membership_gid, params=None, **options): - """Get a project membership - :param str project_membership_gid: (required) - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/project_memberships/{project_membership_gid}".replace("{project_membership_gid}", project_membership_gid) - return self.client.get(path, params, **options) - - def get_project_memberships_for_project(self, project_gid, params=None, **options): - """Get memberships from a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - - user {str}: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/project_memberships".replace("{project_gid}", project_gid) - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/project_statuses.py b/asana/resources/gen/project_statuses.py deleted file mode 100644 index 94e9af82..00000000 --- a/asana/resources/gen/project_statuses.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -class _ProjectStatuses: - - def __init__(self, client=None): - self.client = client - - def create_project_status_for_project(self, project_gid, params=None, **options): - """Create a project status - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/project_statuses".replace("{project_gid}", project_gid) - return self.client.post(path, params, **options) - - def delete_project_status(self, project_status_gid, params=None, **options): - """Delete a project status - :param str project_status_gid: (required) The project status update to get. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/project_statuses/{project_status_gid}".replace("{project_status_gid}", project_status_gid) - return self.client.delete(path, params, **options) - - def get_project_status(self, project_status_gid, params=None, **options): - """Get a project status - :param str project_status_gid: (required) The project status update to get. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/project_statuses/{project_status_gid}".replace("{project_status_gid}", project_status_gid) - return self.client.get(path, params, **options) - - def get_project_statuses_for_project(self, project_gid, params=None, **options): - """Get statuses from a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/project_statuses".replace("{project_gid}", project_gid) - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/project_templates.py b/asana/resources/gen/project_templates.py deleted file mode 100644 index 87c99d29..00000000 --- a/asana/resources/gen/project_templates.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -class _ProjectTemplates: - - def __init__(self, client=None): - self.client = client - - def get_project_template(self, project_template_gid, params=None, **options): - """Get a project template - :param str project_template_gid: (required) Globally unique identifier for the project template. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/project_templates/{project_template_gid}".replace("{project_template_gid}", project_template_gid) - return self.client.get(path, params, **options) - - def get_project_templates(self, params=None, **options): - """Get multiple project templates - :param Object params: Parameters for the request - - workspace {str}: The workspace to filter results on. - - team {str}: The team to filter projects on. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/project_templates" - return self.client.get_collection(path, params, **options) - - def get_project_templates_for_team(self, team_gid, params=None, **options): - """Get a team's project templates - :param str team_gid: (required) Globally unique identifier for the team. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/teams/{team_gid}/project_templates".replace("{team_gid}", team_gid) - return self.client.get_collection(path, params, **options) - - def instantiate_project(self, project_template_gid, params=None, **options): - """Instantiate a project from a project template - :param str project_template_gid: (required) Globally unique identifier for the project template. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/project_templates/{project_template_gid}/instantiateProject".replace("{project_template_gid}", project_template_gid) - return self.client.post(path, params, **options) diff --git a/asana/resources/gen/projects.py b/asana/resources/gen/projects.py deleted file mode 100644 index f93fba92..00000000 --- a/asana/resources/gen/projects.py +++ /dev/null @@ -1,282 +0,0 @@ -# coding=utf-8 -class _Projects: - - def __init__(self, client=None): - self.client = client - - def add_custom_field_setting_for_project(self, project_gid, params=None, **options): - """Add a custom field to a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/addCustomFieldSetting".replace("{project_gid}", project_gid) - return self.client.post(path, params, **options) - - def add_followers_for_project(self, project_gid, params=None, **options): - """Add followers to a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/addFollowers".replace("{project_gid}", project_gid) - return self.client.post(path, params, **options) - - def add_members_for_project(self, project_gid, params=None, **options): - """Add users to a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/addMembers".replace("{project_gid}", project_gid) - return self.client.post(path, params, **options) - - def create_project(self, params=None, **options): - """Create a project - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects" - return self.client.post(path, params, **options) - - def create_project_for_team(self, team_gid, params=None, **options): - """Create a project in a team - :param str team_gid: (required) Globally unique identifier for the team. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/teams/{team_gid}/projects".replace("{team_gid}", team_gid) - return self.client.post(path, params, **options) - - def create_project_for_workspace(self, workspace_gid, params=None, **options): - """Create a project in a workspace - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/projects".replace("{workspace_gid}", workspace_gid) - return self.client.post(path, params, **options) - - def delete_project(self, project_gid, params=None, **options): - """Delete a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}".replace("{project_gid}", project_gid) - return self.client.delete(path, params, **options) - - def duplicate_project(self, project_gid, params=None, **options): - """Duplicate a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/duplicate".replace("{project_gid}", project_gid) - return self.client.post(path, params, **options) - - def get_project(self, project_gid, params=None, **options): - """Get a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}".replace("{project_gid}", project_gid) - return self.client.get(path, params, **options) - - def get_projects(self, params=None, **options): - """Get multiple projects - :param Object params: Parameters for the request - - workspace {str}: The workspace or organization to filter projects on. - - team {str}: The team to filter projects on. - - archived {bool}: Only return projects whose `archived` field takes on the value of this parameter. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects" - return self.client.get_collection(path, params, **options) - - def get_projects_for_task(self, task_gid, params=None, **options): - """Get projects a task is in - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/projects".replace("{task_gid}", task_gid) - return self.client.get_collection(path, params, **options) - - def get_projects_for_team(self, team_gid, params=None, **options): - """Get a team's projects - :param str team_gid: (required) Globally unique identifier for the team. - :param Object params: Parameters for the request - - archived {bool}: Only return projects whose `archived` field takes on the value of this parameter. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/teams/{team_gid}/projects".replace("{team_gid}", team_gid) - return self.client.get_collection(path, params, **options) - - def get_projects_for_workspace(self, workspace_gid, params=None, **options): - """Get all projects in a workspace - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - - archived {bool}: Only return projects whose `archived` field takes on the value of this parameter. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/projects".replace("{workspace_gid}", workspace_gid) - return self.client.get_collection(path, params, **options) - - def get_task_counts_for_project(self, project_gid, params=None, **options): - """Get task count of a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/task_counts".replace("{project_gid}", project_gid) - return self.client.get(path, params, **options) - - def project_save_as_template(self, project_gid, params=None, **options): - """Create a project template from a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/saveAsTemplate".replace("{project_gid}", project_gid) - return self.client.post(path, params, **options) - - def remove_custom_field_setting_for_project(self, project_gid, params=None, **options): - """Remove a custom field from a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/removeCustomFieldSetting".replace("{project_gid}", project_gid) - return self.client.post(path, params, **options) - - def remove_followers_for_project(self, project_gid, params=None, **options): - """Remove followers from a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/removeFollowers".replace("{project_gid}", project_gid) - return self.client.post(path, params, **options) - - def remove_members_for_project(self, project_gid, params=None, **options): - """Remove users from a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/removeMembers".replace("{project_gid}", project_gid) - return self.client.post(path, params, **options) - - def update_project(self, project_gid, params=None, **options): - """Update a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}".replace("{project_gid}", project_gid) - return self.client.put(path, params, **options) diff --git a/asana/resources/gen/sections.py b/asana/resources/gen/sections.py deleted file mode 100644 index 043ac4c0..00000000 --- a/asana/resources/gen/sections.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding=utf-8 -class _Sections: - - def __init__(self, client=None): - self.client = client - - def add_task_for_section(self, section_gid, params=None, **options): - """Add task to section - :param str section_gid: (required) The globally unique identifier for the section. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/sections/{section_gid}/addTask".replace("{section_gid}", section_gid) - return self.client.post(path, params, **options) - - def create_section_for_project(self, project_gid, params=None, **options): - """Create a section in a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/sections".replace("{project_gid}", project_gid) - return self.client.post(path, params, **options) - - def delete_section(self, section_gid, params=None, **options): - """Delete a section - :param str section_gid: (required) The globally unique identifier for the section. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/sections/{section_gid}".replace("{section_gid}", section_gid) - return self.client.delete(path, params, **options) - - def get_section(self, section_gid, params=None, **options): - """Get a section - :param str section_gid: (required) The globally unique identifier for the section. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/sections/{section_gid}".replace("{section_gid}", section_gid) - return self.client.get(path, params, **options) - - def get_sections_for_project(self, project_gid, params=None, **options): - """Get sections in a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/sections".replace("{project_gid}", project_gid) - return self.client.get_collection(path, params, **options) - - def insert_section_for_project(self, project_gid, params=None, **options): - """Move or Insert sections - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/sections/insert".replace("{project_gid}", project_gid) - return self.client.post(path, params, **options) - - def update_section(self, section_gid, params=None, **options): - """Update a section - :param str section_gid: (required) The globally unique identifier for the section. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/sections/{section_gid}".replace("{section_gid}", section_gid) - return self.client.put(path, params, **options) diff --git a/asana/resources/gen/status_updates.py b/asana/resources/gen/status_updates.py deleted file mode 100644 index ef89bd5d..00000000 --- a/asana/resources/gen/status_updates.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -class _StatusUpdates: - - def __init__(self, client=None): - self.client = client - - def create_status_for_object(self, params=None, **options): - """Create a status update - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/status_updates" - return self.client.post(path, params, **options) - - def delete_status(self, status_gid, params=None, **options): - """Delete a status update - :param str status_gid: (required) The status update to get. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/status_updates/{status_gid}".replace("{status_gid}", status_gid) - return self.client.delete(path, params, **options) - - def get_status(self, status_gid, params=None, **options): - """Get a status update - :param str status_gid: (required) The status update to get. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/status_updates/{status_gid}".replace("{status_gid}", status_gid) - return self.client.get(path, params, **options) - - def get_statuses_for_object(self, params=None, **options): - """Get status updates from an object - :param Object params: Parameters for the request - - parent {str}: (required) Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. - - created_since {datetime}: Only return statuses that have been created since the given time. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/status_updates" - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/stories.py b/asana/resources/gen/stories.py deleted file mode 100644 index d0dd73ed..00000000 --- a/asana/resources/gen/stories.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -class _Stories: - - def __init__(self, client=None): - self.client = client - - def create_story_for_task(self, task_gid, params=None, **options): - """Create a story on a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/stories".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def delete_story(self, story_gid, params=None, **options): - """Delete a story - :param str story_gid: (required) Globally unique identifier for the story. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/stories/{story_gid}".replace("{story_gid}", story_gid) - return self.client.delete(path, params, **options) - - def get_stories_for_task(self, task_gid, params=None, **options): - """Get stories from a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/stories".replace("{task_gid}", task_gid) - return self.client.get_collection(path, params, **options) - - def get_story(self, story_gid, params=None, **options): - """Get a story - :param str story_gid: (required) Globally unique identifier for the story. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/stories/{story_gid}".replace("{story_gid}", story_gid) - return self.client.get(path, params, **options) - - def update_story(self, story_gid, params=None, **options): - """Update a story - :param str story_gid: (required) Globally unique identifier for the story. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/stories/{story_gid}".replace("{story_gid}", story_gid) - return self.client.put(path, params, **options) diff --git a/asana/resources/gen/tags.py b/asana/resources/gen/tags.py deleted file mode 100644 index 52fd7988..00000000 --- a/asana/resources/gen/tags.py +++ /dev/null @@ -1,128 +0,0 @@ -# coding=utf-8 -class _Tags: - - def __init__(self, client=None): - self.client = client - - def create_tag(self, params=None, **options): - """Create a tag - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tags" - return self.client.post(path, params, **options) - - def create_tag_for_workspace(self, workspace_gid, params=None, **options): - """Create a tag in a workspace - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/tags".replace("{workspace_gid}", workspace_gid) - return self.client.post(path, params, **options) - - def delete_tag(self, tag_gid, params=None, **options): - """Delete a tag - :param str tag_gid: (required) Globally unique identifier for the tag. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tags/{tag_gid}".replace("{tag_gid}", tag_gid) - return self.client.delete(path, params, **options) - - def get_tag(self, tag_gid, params=None, **options): - """Get a tag - :param str tag_gid: (required) Globally unique identifier for the tag. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tags/{tag_gid}".replace("{tag_gid}", tag_gid) - return self.client.get(path, params, **options) - - def get_tags(self, params=None, **options): - """Get multiple tags - :param Object params: Parameters for the request - - workspace {str}: The workspace to filter tags on. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tags" - return self.client.get_collection(path, params, **options) - - def get_tags_for_task(self, task_gid, params=None, **options): - """Get a task's tags - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/tags".replace("{task_gid}", task_gid) - return self.client.get_collection(path, params, **options) - - def get_tags_for_workspace(self, workspace_gid, params=None, **options): - """Get tags in a workspace - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/tags".replace("{workspace_gid}", workspace_gid) - return self.client.get_collection(path, params, **options) - - def update_tag(self, tag_gid, params=None, **options): - """Update a tag - :param str tag_gid: (required) Globally unique identifier for the tag. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tags/{tag_gid}".replace("{tag_gid}", tag_gid) - return self.client.put(path, params, **options) diff --git a/asana/resources/gen/tasks.py b/asana/resources/gen/tasks.py deleted file mode 100644 index 1b100d28..00000000 --- a/asana/resources/gen/tasks.py +++ /dev/null @@ -1,443 +0,0 @@ -# coding=utf-8 -class _Tasks: - - def __init__(self, client=None): - self.client = client - - def add_dependencies_for_task(self, task_gid, params=None, **options): - """Set dependencies for a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/addDependencies".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def add_dependents_for_task(self, task_gid, params=None, **options): - """Set dependents for a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/addDependents".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def add_followers_for_task(self, task_gid, params=None, **options): - """Add followers to a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/addFollowers".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def add_project_for_task(self, task_gid, params=None, **options): - """Add a project to a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/addProject".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def add_tag_for_task(self, task_gid, params=None, **options): - """Add a tag to a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/addTag".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def create_subtask_for_task(self, task_gid, params=None, **options): - """Create a subtask - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/subtasks".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def create_task(self, params=None, **options): - """Create a task - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks" - return self.client.post(path, params, **options) - - def delete_task(self, task_gid, params=None, **options): - """Delete a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}".replace("{task_gid}", task_gid) - return self.client.delete(path, params, **options) - - def duplicate_task(self, task_gid, params=None, **options): - """Duplicate a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/duplicate".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def get_dependencies_for_task(self, task_gid, params=None, **options): - """Get dependencies from a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/dependencies".replace("{task_gid}", task_gid) - return self.client.get_collection(path, params, **options) - - def get_dependents_for_task(self, task_gid, params=None, **options): - """Get dependents from a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/dependents".replace("{task_gid}", task_gid) - return self.client.get_collection(path, params, **options) - - def get_subtasks_for_task(self, task_gid, params=None, **options): - """Get subtasks from a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/subtasks".replace("{task_gid}", task_gid) - return self.client.get_collection(path, params, **options) - - def get_task(self, task_gid, params=None, **options): - """Get a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}".replace("{task_gid}", task_gid) - return self.client.get(path, params, **options) - - def get_tasks(self, params=None, **options): - """Get multiple tasks - :param Object params: Parameters for the request - - assignee {str}: The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.* - - project {str}: The project to filter tasks on. - - section {str}: The section to filter tasks on. - - workspace {str}: The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.* - - completed_since {datetime}: Only return tasks that are either incomplete or that have been completed since this time. - - modified_since {datetime}: Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.* - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks" - return self.client.get_collection(path, params, **options) - - def get_tasks_for_project(self, project_gid, params=None, **options): - """Get tasks from a project - :param str project_gid: (required) Globally unique identifier for the project. - :param Object params: Parameters for the request - - completed_since {str}: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/projects/{project_gid}/tasks".replace("{project_gid}", project_gid) - return self.client.get_collection(path, params, **options) - - def get_tasks_for_section(self, section_gid, params=None, **options): - """Get tasks from a section - :param str section_gid: (required) The globally unique identifier for the section. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/sections/{section_gid}/tasks".replace("{section_gid}", section_gid) - return self.client.get_collection(path, params, **options) - - def get_tasks_for_tag(self, tag_gid, params=None, **options): - """Get tasks from a tag - :param str tag_gid: (required) Globally unique identifier for the tag. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tags/{tag_gid}/tasks".replace("{tag_gid}", tag_gid) - return self.client.get_collection(path, params, **options) - - def get_tasks_for_user_task_list(self, user_task_list_gid, params=None, **options): - """Get tasks from a user task list - :param str user_task_list_gid: (required) Globally unique identifier for the user task list. - :param Object params: Parameters for the request - - completed_since {str}: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/user_task_lists/{user_task_list_gid}/tasks".replace("{user_task_list_gid}", user_task_list_gid) - return self.client.get_collection(path, params, **options) - - def remove_dependencies_for_task(self, task_gid, params=None, **options): - """Unlink dependencies from a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/removeDependencies".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def remove_dependents_for_task(self, task_gid, params=None, **options): - """Unlink dependents from a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/removeDependents".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def remove_follower_for_task(self, task_gid, params=None, **options): - """Remove followers from a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/removeFollowers".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def remove_project_for_task(self, task_gid, params=None, **options): - """Remove a project from a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/removeProject".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def remove_tag_for_task(self, task_gid, params=None, **options): - """Remove a tag from a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/removeTag".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def search_tasks_for_workspace(self, workspace_gid, params=None, **options): - """Search tasks in a workspace - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - - text {str}: Performs full-text search on both task name and description - - resource_subtype {str}: Filters results by the task's resource_subtype - - assignee_any {str}: Comma-separated list of user identifiers - - assignee_not {str}: Comma-separated list of user identifiers - - portfolios_any {str}: Comma-separated list of portfolio IDs - - projects_any {str}: Comma-separated list of project IDs - - projects_not {str}: Comma-separated list of project IDs - - projects_all {str}: Comma-separated list of project IDs - - sections_any {str}: Comma-separated list of section or column IDs - - sections_not {str}: Comma-separated list of section or column IDs - - sections_all {str}: Comma-separated list of section or column IDs - - tags_any {str}: Comma-separated list of tag IDs - - tags_not {str}: Comma-separated list of tag IDs - - tags_all {str}: Comma-separated list of tag IDs - - teams_any {str}: Comma-separated list of team IDs - - followers_not {str}: Comma-separated list of user identifiers - - created_by_any {str}: Comma-separated list of user identifiers - - created_by_not {str}: Comma-separated list of user identifiers - - assigned_by_any {str}: Comma-separated list of user identifiers - - assigned_by_not {str}: Comma-separated list of user identifiers - - liked_by_not {str}: Comma-separated list of user identifiers - - commented_on_by_not {str}: Comma-separated list of user identifiers - - due_on_before {date}: ISO 8601 date string - - due_on_after {date}: ISO 8601 date string - - due_on {date}: ISO 8601 date string or `null` - - due_at_before {datetime}: ISO 8601 datetime string - - due_at_after {datetime}: ISO 8601 datetime string - - start_on_before {date}: ISO 8601 date string - - start_on_after {date}: ISO 8601 date string - - start_on {date}: ISO 8601 date string or `null` - - created_on_before {date}: ISO 8601 date string - - created_on_after {date}: ISO 8601 date string - - created_on {date}: ISO 8601 date string or `null` - - created_at_before {datetime}: ISO 8601 datetime string - - created_at_after {datetime}: ISO 8601 datetime string - - completed_on_before {date}: ISO 8601 date string - - completed_on_after {date}: ISO 8601 date string - - completed_on {date}: ISO 8601 date string or `null` - - completed_at_before {datetime}: ISO 8601 datetime string - - completed_at_after {datetime}: ISO 8601 datetime string - - modified_on_before {date}: ISO 8601 date string - - modified_on_after {date}: ISO 8601 date string - - modified_on {date}: ISO 8601 date string or `null` - - modified_at_before {datetime}: ISO 8601 datetime string - - modified_at_after {datetime}: ISO 8601 datetime string - - is_blocking {bool}: Filter to incomplete tasks with dependents - - is_blocked {bool}: Filter to tasks with incomplete dependencies - - has_attachment {bool}: Filter to tasks with attachments - - completed {bool}: Filter to completed tasks - - is_subtask {bool}: Filter to subtasks - - sort_by {str}: One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at` - - sort_ascending {bool}: Default `false` - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/tasks/search".replace("{workspace_gid}", workspace_gid) - return self.client.get_collection(path, params, **options) - - def set_parent_for_task(self, task_gid, params=None, **options): - """Set the parent of a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}/setParent".replace("{task_gid}", task_gid) - return self.client.post(path, params, **options) - - def update_task(self, task_gid, params=None, **options): - """Update a task - :param str task_gid: (required) The task to operate on. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/tasks/{task_gid}".replace("{task_gid}", task_gid) - return self.client.put(path, params, **options) diff --git a/asana/resources/gen/team_memberships.py b/asana/resources/gen/team_memberships.py deleted file mode 100644 index ef3ba93c..00000000 --- a/asana/resources/gen/team_memberships.py +++ /dev/null @@ -1,70 +0,0 @@ -# coding=utf-8 -class _TeamMemberships: - - def __init__(self, client=None): - self.client = client - - def get_team_membership(self, team_membership_gid, params=None, **options): - """Get a team membership - :param str team_membership_gid: (required) - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/team_memberships/{team_membership_gid}".replace("{team_membership_gid}", team_membership_gid) - return self.client.get(path, params, **options) - - def get_team_memberships(self, params=None, **options): - """Get team memberships - :param Object params: Parameters for the request - - team {str}: Globally unique identifier for the team. - - user {str}: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter. - - workspace {str}: Globally unique identifier for the workspace. This parameter must be used with the user parameter. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/team_memberships" - return self.client.get_collection(path, params, **options) - - def get_team_memberships_for_team(self, team_gid, params=None, **options): - """Get memberships from a team - :param str team_gid: (required) Globally unique identifier for the team. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/teams/{team_gid}/team_memberships".replace("{team_gid}", team_gid) - return self.client.get_collection(path, params, **options) - - def get_team_memberships_for_user(self, user_gid, params=None, **options): - """Get memberships from a user - :param str user_gid: (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. - :param Object params: Parameters for the request - - workspace {str}: (required) Globally unique identifier for the workspace. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/users/{user_gid}/team_memberships".replace("{user_gid}", user_gid) - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/teams.py b/asana/resources/gen/teams.py deleted file mode 100644 index 459f0b34..00000000 --- a/asana/resources/gen/teams.py +++ /dev/null @@ -1,112 +0,0 @@ -# coding=utf-8 -class _Teams: - - def __init__(self, client=None): - self.client = client - - def add_user_for_team(self, team_gid, params=None, **options): - """Add a user to a team - :param str team_gid: (required) Globally unique identifier for the team. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/teams/{team_gid}/addUser".replace("{team_gid}", team_gid) - return self.client.post(path, params, **options) - - def create_team(self, params=None, **options): - """Create a team - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/teams" - return self.client.post(path, params, **options) - - def get_team(self, team_gid, params=None, **options): - """Get a team - :param str team_gid: (required) Globally unique identifier for the team. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/teams/{team_gid}".replace("{team_gid}", team_gid) - return self.client.get(path, params, **options) - - def get_teams_for_user(self, user_gid, params=None, **options): - """Get teams for a user - :param str user_gid: (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. - :param Object params: Parameters for the request - - organization {str}: (required) The workspace or organization to filter teams on. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/users/{user_gid}/teams".replace("{user_gid}", user_gid) - return self.client.get_collection(path, params, **options) - - def get_teams_for_workspace(self, workspace_gid, params=None, **options): - """Get teams in a workspace - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/teams".replace("{workspace_gid}", workspace_gid) - return self.client.get_collection(path, params, **options) - - def remove_user_for_team(self, team_gid, params=None, **options): - """Remove a user from a team - :param str team_gid: (required) Globally unique identifier for the team. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/teams/{team_gid}/removeUser".replace("{team_gid}", team_gid) - return self.client.post(path, params, **options) - - def update_team(self, params=None, **options): - """Update a team - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/teams" - return self.client.put(path, params, **options) diff --git a/asana/resources/gen/time_periods.py b/asana/resources/gen/time_periods.py deleted file mode 100644 index a1471b9f..00000000 --- a/asana/resources/gen/time_periods.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -class _TimePeriods: - - def __init__(self, client=None): - self.client = client - - def get_time_period(self, time_period_gid, params=None, **options): - """Get a time period - :param str time_period_gid: (required) Globally unique identifier for the time period. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/time_periods/{time_period_gid}".replace("{time_period_gid}", time_period_gid) - return self.client.get(path, params, **options) - - def get_time_periods(self, params=None, **options): - """Get time periods - :param Object params: Parameters for the request - - start_on {date}: ISO 8601 date string - - end_on {date}: ISO 8601 date string - - workspace {str}: (required) Globally unique identifier for the workspace. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/time_periods" - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/typeahead.py b/asana/resources/gen/typeahead.py deleted file mode 100644 index c23110cf..00000000 --- a/asana/resources/gen/typeahead.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -class _Typeahead: - - def __init__(self, client=None): - self.client = client - - def typeahead_for_workspace(self, workspace_gid, params=None, **options): - """Get objects via typeahead - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - - resource_type {str}: (required) The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `project`, `project_template`, `portfolio`, `tag`, `task`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported. - - type {str}: *Deprecated: new integrations should prefer the resource_type field.* - - query {str}: The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results. - - count {int}: The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned. - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/typeahead".replace("{workspace_gid}", workspace_gid) - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/user_task_lists.py b/asana/resources/gen/user_task_lists.py deleted file mode 100644 index b59a9d56..00000000 --- a/asana/resources/gen/user_task_lists.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -class _UserTaskLists: - - def __init__(self, client=None): - self.client = client - - def get_user_task_list(self, user_task_list_gid, params=None, **options): - """Get a user task list - :param str user_task_list_gid: (required) Globally unique identifier for the user task list. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/user_task_lists/{user_task_list_gid}".replace("{user_task_list_gid}", user_task_list_gid) - return self.client.get(path, params, **options) - - def get_user_task_list_for_user(self, user_gid, params=None, **options): - """Get a user's task list - :param str user_gid: (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. - :param Object params: Parameters for the request - - workspace {str}: (required) The workspace in which to get the user task list. - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/users/{user_gid}/user_task_list".replace("{user_gid}", user_gid) - return self.client.get(path, params, **options) diff --git a/asana/resources/gen/users.py b/asana/resources/gen/users.py deleted file mode 100644 index 55538f6e..00000000 --- a/asana/resources/gen/users.py +++ /dev/null @@ -1,82 +0,0 @@ -# coding=utf-8 -class _Users: - - def __init__(self, client=None): - self.client = client - - def get_favorites_for_user(self, user_gid, params=None, **options): - """Get a user's favorites - :param str user_gid: (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. - :param Object params: Parameters for the request - - resource_type {str}: (required) The resource type of favorites to be returned. - - workspace {str}: (required) The workspace in which to get favorites. - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/users/{user_gid}/favorites".replace("{user_gid}", user_gid) - return self.client.get_collection(path, params, **options) - - def get_user(self, user_gid, params=None, **options): - """Get a user - :param str user_gid: (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/users/{user_gid}".replace("{user_gid}", user_gid) - return self.client.get(path, params, **options) - - def get_users(self, params=None, **options): - """Get multiple users - :param Object params: Parameters for the request - - workspace {str}: The workspace or organization ID to filter users on. - - team {str}: The team ID to filter users on. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/users" - return self.client.get_collection(path, params, **options) - - def get_users_for_team(self, team_gid, params=None, **options): - """Get users in a team - :param str team_gid: (required) Globally unique identifier for the team. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/teams/{team_gid}/users".replace("{team_gid}", team_gid) - return self.client.get_collection(path, params, **options) - - def get_users_for_workspace(self, workspace_gid, params=None, **options): - """Get users in a workspace or organization - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/users".replace("{workspace_gid}", workspace_gid) - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/webhooks.py b/asana/resources/gen/webhooks.py deleted file mode 100644 index 29a59840..00000000 --- a/asana/resources/gen/webhooks.py +++ /dev/null @@ -1,77 +0,0 @@ -# coding=utf-8 -class _Webhooks: - - def __init__(self, client=None): - self.client = client - - def create_webhook(self, params=None, **options): - """Establish a webhook - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/webhooks" - return self.client.post(path, params, **options) - - def delete_webhook(self, webhook_gid, params=None, **options): - """Delete a webhook - :param str webhook_gid: (required) Globally unique identifier for the webhook. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/webhooks/{webhook_gid}".replace("{webhook_gid}", webhook_gid) - return self.client.delete(path, params, **options) - - def get_webhook(self, webhook_gid, params=None, **options): - """Get a webhook - :param str webhook_gid: (required) Globally unique identifier for the webhook. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/webhooks/{webhook_gid}".replace("{webhook_gid}", webhook_gid) - return self.client.get(path, params, **options) - - def get_webhooks(self, params=None, **options): - """Get multiple webhooks - :param Object params: Parameters for the request - - workspace {str}: (required) The workspace to query for webhooks in. - - resource {str}: Only return webhooks for the given resource. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/webhooks" - return self.client.get_collection(path, params, **options) - - def update_webhook(self, webhook_gid, params=None, **options): - """Update a webhook - :param str webhook_gid: (required) Globally unique identifier for the webhook. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/webhooks/{webhook_gid}".replace("{webhook_gid}", webhook_gid) - return self.client.put(path, params, **options) diff --git a/asana/resources/gen/workspace_memberships.py b/asana/resources/gen/workspace_memberships.py deleted file mode 100644 index ec84ddb7..00000000 --- a/asana/resources/gen/workspace_memberships.py +++ /dev/null @@ -1,52 +0,0 @@ -# coding=utf-8 -class _WorkspaceMemberships: - - def __init__(self, client=None): - self.client = client - - def get_workspace_membership(self, workspace_membership_gid, params=None, **options): - """Get a workspace membership - :param str workspace_membership_gid: (required) - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspace_memberships/{workspace_membership_gid}".replace("{workspace_membership_gid}", workspace_membership_gid) - return self.client.get(path, params, **options) - - def get_workspace_memberships_for_user(self, user_gid, params=None, **options): - """Get workspace memberships for a user - :param str user_gid: (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/users/{user_gid}/workspace_memberships".replace("{user_gid}", user_gid) - return self.client.get_collection(path, params, **options) - - def get_workspace_memberships_for_workspace(self, workspace_gid, params=None, **options): - """Get the workspace memberships for a workspace - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - - user {str}: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/workspace_memberships".replace("{workspace_gid}", workspace_gid) - return self.client.get_collection(path, params, **options) diff --git a/asana/resources/gen/workspaces.py b/asana/resources/gen/workspaces.py deleted file mode 100644 index 0250dffd..00000000 --- a/asana/resources/gen/workspaces.py +++ /dev/null @@ -1,76 +0,0 @@ -# coding=utf-8 -class _Workspaces: - - def __init__(self, client=None): - self.client = client - - def add_user_for_workspace(self, workspace_gid, params=None, **options): - """Add a user to a workspace or organization - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/addUser".replace("{workspace_gid}", workspace_gid) - return self.client.post(path, params, **options) - - def get_workspace(self, workspace_gid, params=None, **options): - """Get a workspace - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}".replace("{workspace_gid}", workspace_gid) - return self.client.get(path, params, **options) - - def get_workspaces(self, params=None, **options): - """Get multiple workspaces - :param Object params: Parameters for the request - :param **options - - offset {str}: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' - - limit {int}: Results per page. The number of objects to return per page. The value must be between 1 and 100. - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces" - return self.client.get_collection(path, params, **options) - - def remove_user_for_workspace(self, workspace_gid, params=None, **options): - """Remove a user from a workspace or organization - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}/removeUser".replace("{workspace_gid}", workspace_gid) - return self.client.post(path, params, **options) - - def update_workspace(self, workspace_gid, params=None, **options): - """Update a workspace - :param str workspace_gid: (required) Globally unique identifier for the workspace or organization. - :param Object params: Parameters for the request - :param **options - - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. - - opt_pretty {bool}: Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. - :return: Object - """ - if params is None: - params = {} - path = "/workspaces/{workspace_gid}".replace("{workspace_gid}", workspace_gid) - return self.client.put(path, params, **options) diff --git a/asana/resources/goal_relationships.py b/asana/resources/goal_relationships.py deleted file mode 100644 index 8580407d..00000000 --- a/asana/resources/goal_relationships.py +++ /dev/null @@ -1,5 +0,0 @@ -from .gen.goal_relationships import _GoalRelationships - -class GoalRelationships(_GoalRelationships): - """Goal relationships resource""" - pass diff --git a/asana/resources/goals.py b/asana/resources/goals.py deleted file mode 100644 index 7d2b961d..00000000 --- a/asana/resources/goals.py +++ /dev/null @@ -1,6 +0,0 @@ - -from .gen.goals import _Goals - -class Goals(_Goals): - """Goals resource""" - pass diff --git a/asana/resources/jobs.py b/asana/resources/jobs.py deleted file mode 100644 index d10f7e83..00000000 --- a/asana/resources/jobs.py +++ /dev/null @@ -1,15 +0,0 @@ - -from .gen.jobs import _Jobs - -class Jobs(_Jobs): - """Jobs resource""" - def find_by_id(self, job, params={}, **options): - """Returns the complete job record for a single job. - - Parameters - ---------- - job : {Gid} The job to get. - [params] : {Object} Parameters for the request - """ - path = "/jobs/%s" % (job) - return self.client.get(path, params, **options) diff --git a/asana/resources/memberships.py b/asana/resources/memberships.py deleted file mode 100644 index 1da78a76..00000000 --- a/asana/resources/memberships.py +++ /dev/null @@ -1,5 +0,0 @@ -from .gen.memberships import _Memberships - -class Memberships(_Memberships): - """Memberships resource""" - pass diff --git a/asana/resources/message.py b/asana/resources/message.py deleted file mode 100644 index 8eeacca6..00000000 --- a/asana/resources/message.py +++ /dev/null @@ -1,6 +0,0 @@ - -from .gen.message import _Message - -class Message(_Message): - """Message resource""" - pass diff --git a/asana/resources/organization_exports.py b/asana/resources/organization_exports.py deleted file mode 100644 index e649b7c0..00000000 --- a/asana/resources/organization_exports.py +++ /dev/null @@ -1,30 +0,0 @@ -from .gen.organization_exports import _OrganizationExports - - -class OrganizationExports(_OrganizationExports): - """The :class:`OrganizationExports` object, which represents the resource - of the same name in Asana's API. - - """ - - def find_by_id(self, organization_export, params={}, **options): - """Returns details of a previously-requested Organization export. - - Parameters - ---------- - organization_export : {Gid} Globally unique identifier for the Organization export. - [params] : {Object} Parameters for the request - """ - path = "/organization_exports/%s" % (organization_export) - return self.client.get(path, params, **options) - - def create(self, params={}, **options): - """This method creates a request to export an Organization. Asana will complete the export at some - point after you create the request. - - Parameters - ---------- - [data] : {Object} Data for the request - - organization : {Gid} Globally unique identifier for the workspace or organization. - """ - return self.client.post("/organization_exports", params, **options) diff --git a/asana/resources/portfolio_memberships.py b/asana/resources/portfolio_memberships.py deleted file mode 100644 index ae20ffea..00000000 --- a/asana/resources/portfolio_memberships.py +++ /dev/null @@ -1,42 +0,0 @@ - -from .gen.portfolio_memberships import _PortfolioMemberships - -class PortfolioMemberships(_PortfolioMemberships): - """Portfolio Memberships resource""" - - def find_all(self, params={}, **options): - """Returns the compact portfolio membership records for the portfolio. You must - specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`. - - Parameters - ---------- - [params] : {Object} Parameters for the request - - [portfolio] : {Gid} The portfolio for which to fetch memberships. - - [workspace] : {Gid} The workspace for which to fetch memberships. - - [user] : {String} The user to filter the memberships to. - """ - return self.client.get_collection("/portfolio_memberships", params, **options) - - def find_by_portfolio(self, portfolio, params={}, **options): - """Returns the compact portfolio membership records for the portfolio. - - Parameters - ---------- - portfolio : {Gid} The portfolio for which to fetch memberships. - [params] : {Object} Parameters for the request - - [user] : {String} If present, the user to filter the memberships to. - """ - path = "/portfolios/%s/portfolio_memberships" % (portfolio) - return self.client.get_collection(path, params, **options) - - def find_by_id(self, portfolio_membership, params={}, **options): - """Returns the portfolio membership record. - - Parameters - ---------- - portfolio_membership : {Gid} Globally unique identifier for the portfolio membership. - [params] : {Object} Parameters for the request - """ - path = "/portfolio_memberships/%s" % (portfolio_membership) - return self.client.get(path, params, **options) - diff --git a/asana/resources/portfolios.py b/asana/resources/portfolios.py deleted file mode 100644 index fbe27435..00000000 --- a/asana/resources/portfolios.py +++ /dev/null @@ -1,184 +0,0 @@ - -from .gen.portfolios import _Portfolios - -class Portfolios(_Portfolios): - """Portfolios resource""" - - def create(self, params={}, **options): - """Creates a new portfolio in the given workspace with the supplied name. - - Note that portfolios created in the Asana UI may have some state - (like the "Priority" custom field) which is automatically added to the - portfolio when it is created. Portfolios created via our API will **not** - be created with the same initial state to allow integrations to create - their own starting state on a portfolio. - - Parameters - ---------- - [data] : {Object} Data for the request - - workspace : {Gid} The workspace or organization in which to create the portfolio. - - name : {String} The name of the newly-created portfolio - - [color] : {String} An optional color for the portfolio - """ - return self.client.post("/portfolios", params, **options) - - def find_by_id(self, portfolio, params={}, **options): - """Returns the complete record for a single portfolio. - - Parameters - ---------- - portfolio : {Gid} The portfolio to get. - [params] : {Object} Parameters for the request - """ - path = "/portfolios/%s" % (portfolio) - return self.client.get(path, params, **options) - - def update(self, portfolio, params={}, **options): - """An existing portfolio can be updated by making a PUT request on the - URL for that portfolio. Only the fields provided in the `data` block will be - updated; any unspecified fields will remain unchanged. - - Returns the complete updated portfolio record. - - Parameters - ---------- - portfolio : {Gid} The portfolio to update. - [data] : {Object} Data for the request - """ - path = "/portfolios/%s" % (portfolio) - return self.client.put(path, params, **options) - - def delete(self, portfolio, params={}, **options): - """An existing portfolio can be deleted by making a DELETE request - on the URL for that portfolio. - - Returns an empty data record. - - Parameters - ---------- - portfolio : {Gid} The portfolio to delete. - """ - path = "/portfolios/%s" % (portfolio) - return self.client.delete(path, params, **options) - - def find_all(self, params={}, **options): - """Returns a list of the portfolios in compact representation that are owned - by the current API user. - - Parameters - ---------- - [params] : {Object} Parameters for the request - - workspace : {Gid} The workspace or organization to filter portfolios on. - - owner : {String} The user who owns the portfolio. Currently, API users can only get a - list of portfolios that they themselves own. - """ - return self.client.get_collection("/portfolios", params, **options) - - def get_items(self, portfolio, params={}, **options): - """Get a list of the items in compact form in a portfolio. - - Parameters - ---------- - portfolio : {Gid} The portfolio from which to get the list of items. - [params] : {Object} Parameters for the request - """ - path = "/portfolios/%s/items" % (portfolio) - return self.client.get_collection(path, params, **options) - - def add_item(self, portfolio, params={}, **options): - """Add an item to a portfolio. - - Returns an empty data block. - - Parameters - ---------- - portfolio : {Gid} The portfolio to which to add an item. - [data] : {Object} Data for the request - - item : {Gid} The item to add to the portfolio. - - [insert_before] : {Gid} An id of an item in this portfolio. The new item will be added before the one specified here. - `insert_before` and `insert_after` parameters cannot both be specified. - - [insert_after] : {Gid} An id of an item in this portfolio. The new item will be added after the one specified here. - `insert_before` and `insert_after` parameters cannot both be specified. - """ - path = "/portfolios/%s/addItem" % (portfolio) - return self.client.post(path, params, **options) - - def remove_item(self, portfolio, params={}, **options): - """Remove an item to a portfolio. - - Returns an empty data block. - - Parameters - ---------- - portfolio : {Gid} The portfolio from which to remove the item. - [data] : {Object} Data for the request - - item : {Gid} The item to remove from the portfolio. - """ - path = "/portfolios/%s/removeItem" % (portfolio) - return self.client.post(path, params, **options) - - def add_members(self, portfolio, params={}, **options): - """Adds the specified list of users as members of the portfolio. Returns the updated portfolio record. - - Parameters - ---------- - portfolio : {Gid} The portfolio to add members to. - [data] : {Object} Data for the request - - members : {Array} An array of user ids. - """ - path = "/portfolios/%s/addMembers" % (portfolio) - return self.client.post(path, params, **options) - - def remove_members(self, portfolio, params={}, **options): - """Removes the specified list of members from the portfolio. Returns the updated portfolio record. - - Parameters - ---------- - portfolio : {Gid} The portfolio to remove members from. - [data] : {Object} Data for the request - - members : {Array} An array of user ids. - """ - path = "/portfolios/%s/removeMembers" % (portfolio) - return self.client.post(path, params, **options) - - def custom_field_settings(self, portfolio, params={}, **options): - """Get the custom field settings on a portfolio. - - Parameters - ---------- - portfolio : {Gid} The portfolio from which to get the custom field settings. - [params] : {Object} Parameters for the request - """ - path = "/portfolios/%s/custom_field_settings" % (portfolio) - return self.client.get_collection(path, params, **options) - - def add_custom_field_setting(self, portfolio, params={}, **options): - """Create a new custom field setting on the portfolio. Returns the full - record for the new custom field setting. - - Parameters - ---------- - portfolio : {Gid} The portfolio onto which to add the custom field. - [data] : {Object} Data for the request - - custom_field : {Gid} The id of the custom field to add to the portfolio. - - [is_important] : {Boolean} Whether this field should be considered important to this portfolio (for instance, to display in the list view of items in the portfolio). - - [insert_before] : {Gid} An id of a custom field setting on this portfolio. The new custom field setting will be added before this one. - `insert_before` and `insert_after` parameters cannot both be specified. - - [insert_after] : {Gid} An id of a custom field setting on this portfolio. The new custom field setting will be added after this one. - `insert_before` and `insert_after` parameters cannot both be specified. - """ - path = "/portfolios/%s/addCustomFieldSetting" % (portfolio) - return self.client.post(path, params, **options) - - def remove_custom_field_setting(self, portfolio, params={}, **options): - """Remove a custom field setting on the portfolio. Returns an empty data - block. - - Parameters - ---------- - portfolio : {Gid} The portfolio from which to remove the custom field. - [data] : {Object} Data for the request - - custom_field : {Gid} The id of the custom field to remove from this portfolio. - """ - path = "/portfolios/%s/removeCustomFieldSetting" % (portfolio) - return self.client.post(path, params, **options) diff --git a/asana/resources/project_briefs.py b/asana/resources/project_briefs.py deleted file mode 100644 index ff73b5d1..00000000 --- a/asana/resources/project_briefs.py +++ /dev/null @@ -1,6 +0,0 @@ - -from .gen.project_briefs import _ProjectBriefs - -class ProjectBriefs(_ProjectBriefs): - """ProjectBriefs resource""" - pass diff --git a/asana/resources/project_memberships.py b/asana/resources/project_memberships.py deleted file mode 100644 index ec44a91b..00000000 --- a/asana/resources/project_memberships.py +++ /dev/null @@ -1,29 +0,0 @@ - -from .gen.project_memberships import _ProjectMemberships - -class ProjectMemberships(_ProjectMemberships): - """Project Memberships resource""" - - def find_by_project(self, project, params={}, **options): - """Returns the compact project membership records for the project. - - Parameters - ---------- - project : {Gid} The project for which to fetch memberships. - [params] : {Object} Parameters for the request - - [user] : {String} If present, the user to filter the memberships to. - """ - path = "/projects/%s/project_memberships" % (project) - return self.client.get_collection(path, params, **options) - - def find_by_id(self, project_membership, params={}, **options): - """Returns the project membership record. - - Parameters - ---------- - project_membership : {Gid} Globally unique identifier for the project membership. - [params] : {Object} Parameters for the request - """ - path = "/project_memberships/%s" % (project_membership) - return self.client.get(path, params, **options) - diff --git a/asana/resources/project_statuses.py b/asana/resources/project_statuses.py deleted file mode 100644 index 397e0bec..00000000 --- a/asana/resources/project_statuses.py +++ /dev/null @@ -1,56 +0,0 @@ - -from .gen.project_statuses import _ProjectStatuses - -class ProjectStatuses(_ProjectStatuses): - """Project Statuses resource""" - def create(self, project, params={}, **options): - self.create_in_project(project, params, **options) - - def create_in_project(self, project, params={}, **options): - """Creates a new status update on the project. - - Returns the full record of the newly created project status update. - - Parameters - ---------- - project : {Gid} The project on which to create a status update. - [data] : {Object} Data for the request - - text : {String} The text of the project status update. - - color : {String} The color to associate with the status update. Must be one of `"red"`, `"yellow"`, or `"green"`. - """ - path = "/projects/%s/project_statuses" % (project) - return self.client.post(path, params, **options) - - def find_by_project(self, project, params={}, **options): - """Returns the compact project status update records for all updates on the project. - - Parameters - ---------- - project : {Gid} The project to find status updates for. - [params] : {Object} Parameters for the request - """ - path = "/projects/%s/project_statuses" % (project) - return self.client.get_collection(path, params, **options) - - def find_by_id(self, project_status, params={}, **options): - """Returns the complete record for a single status update. - - Parameters - ---------- - project-status : {Gid} The project status update to get. - [params] : {Object} Parameters for the request - """ - path = "/project_statuses/%s" % (project_status) - return self.client.get(path, params, **options) - - def delete(self, project_status, params={}, **options): - """Deletes a specific, existing project status update. - - Returns an empty data record. - - Parameters - ---------- - project-status : {Gid} The project status update to delete. - """ - path = "/project_statuses/%s" % (project_status) - return self.client.delete(path, params, **options) diff --git a/asana/resources/project_templates.py b/asana/resources/project_templates.py deleted file mode 100644 index 3715a537..00000000 --- a/asana/resources/project_templates.py +++ /dev/null @@ -1,6 +0,0 @@ - -from .gen.project_templates import _ProjectTemplates - -class ProjectTemplates(_ProjectTemplates): - """ProjectTemplates resource""" - pass diff --git a/asana/resources/projects.py b/asana/resources/projects.py deleted file mode 100644 index d4c38c9f..00000000 --- a/asana/resources/projects.py +++ /dev/null @@ -1,258 +0,0 @@ - -from .gen.projects import _Projects - -class Projects(_Projects): - """Projects resource""" - def create(self, params={}, **options): - """Creates a new project in a workspace or team. - - Every project is required to be created in a specific workspace or - organization, and this cannot be changed once set. Note that you can use - the `workspace` parameter regardless of whether or not it is an - organization. - - If the workspace for your project _is_ an organization, you must also - supply a `team` to share the project with. - - Returns the full record of the newly created project. - - Parameters - ---------- - [data] : {Object} Data for the request - - workspace : {Gid} The workspace or organization to create the project in. - - [team] : {Gid} If creating in an organization, the specific team to create the - project in. - """ - return self.client.post("/projects", params, **options) - - def create_in_workspace(self, workspace, params={}, **options): - """If the workspace for your project _is_ an organization, you must also - supply a `team` to share the project with. - - Returns the full record of the newly created project. - - Parameters - ---------- - workspace : {Gid} The workspace or organization to create the project in. - [data] : {Object} Data for the request - """ - path = "/workspaces/%s/projects" % (workspace) - return self.client.post(path, params, **options) - - def create_in_team(self, team, params={}, **options): - """Creates a project shared with the given team. - - Returns the full record of the newly created project. - - Parameters - ---------- - team : {Gid} The team to create the project in. - [data] : {Object} Data for the request - """ - path = "/teams/%s/projects" % (team) - return self.client.post(path, params, **options) - - def find_by_id(self, project, params={}, **options): - """Returns the complete project record for a single project. - - Parameters - ---------- - project : {Gid} The project to get. - [params] : {Object} Parameters for the request - """ - path = "/projects/%s" % (project) - return self.client.get(path, params, **options) - - def update(self, project, params={}, **options): - """A specific, existing project can be updated by making a PUT request on the - URL for that project. Only the fields provided in the `data` block will be - updated; any unspecified fields will remain unchanged. - - When using this method, it is best to specify only those fields you wish - to change, or else you may overwrite changes made by another user since - you last retrieved the task. - - Returns the complete updated project record. - - Parameters - ---------- - project : {Gid} The project to update. - [data] : {Object} Data for the request - """ - path = "/projects/%s" % (project) - return self.client.put(path, params, **options) - - def delete(self, project, params={}, **options): - """A specific, existing project can be deleted by making a DELETE request - on the URL for that project. - - Returns an empty data record. - - Parameters - ---------- - project : {Gid} The project to delete. - """ - path = "/projects/%s" % (project) - return self.client.delete(path, params, **options) - - def duplicate_project(self, project, params={}, **options): - """Creates and returns a job that will asynchronously handle the duplication. - - Parameters - ---------- - project : {Gid} The project to duplicate. - [data] : {Object} Data for the request - - name : {String} The name of the new project. - - [team] : {Gid} Sets the team of the new project. If team is not defined, the new project - will be in the same team as the the original project. - - [include] : {Array} The elements that will be duplicated to the new project. - Tasks are always included. - - [schedule_dates] : {String} A dictionary of options to auto-shift dates. - `task_dates` must be included to use this option. - Requires either `start_on` or `due_on`, but not both. - `start_on` will set the first start date of the new - project to the given date, while `due_on` will set the last due date - to the given date. Both will offset the remaining dates by the same amount - of the original project. - """ - path = "/projects/%s/duplicate" % (project) - return self.client.post(path, params, **options) - - def find_all(self, params={}, **options): - """Returns the compact project records for some filtered set of projects. - Use one or more of the parameters provided to filter the projects returned. - - Parameters - ---------- - [params] : {Object} Parameters for the request - - [workspace] : {Gid} The workspace or organization to filter projects on. - - [team] : {Gid} The team to filter projects on. - - [is_template] : {Boolean} **Note: This parameter can only be included if a team is also defined, or the workspace is not an organization** - Filters results to include only template projects. - - [archived] : {Boolean} Only return projects whose `archived` field takes on the value of - this parameter. - """ - return self.client.get_collection("/projects", params, **options) - - def find_by_workspace(self, workspace, params={}, **options): - """Returns the compact project records for all projects in the workspace. - - Parameters - ---------- - workspace : {Gid} The workspace or organization to find projects in. - [params] : {Object} Parameters for the request - - [is_template] : {Boolean} **Note: This parameter can only be included if a team is also defined, or the workspace is not an organization** - Filters results to include only template projects. - - [archived] : {Boolean} Only return projects whose `archived` field takes on the value of - this parameter. - """ - path = "/workspaces/%s/projects" % (workspace) - return self.client.get_collection(path, params, **options) - - def find_by_team(self, team, params={}, **options): - """Returns the compact project records for all projects in the team. - - Parameters - ---------- - team : {Gid} The team to find projects in. - [params] : {Object} Parameters for the request - - [is_template] : {Boolean} Filters results to include only template projects. - - [archived] : {Boolean} Only return projects whose `archived` field takes on the value of - this parameter. - """ - path = "/teams/%s/projects" % (team) - return self.client.get_collection(path, params, **options) - - def tasks(self, project, params={}, **options): - """Returns the compact task records for all tasks within the given project, - ordered by their priority within the project. Tasks can exist in more than one project at a time. - - Parameters - ---------- - project : {Gid} The project in which to search for tasks. - [params] : {Object} Parameters for the request - """ - path = "/projects/%s/tasks" % (project) - return self.client.get_collection(path, params, **options) - - def add_followers(self, project, params={}, **options): - """Adds the specified list of users as followers to the project. Followers are a subset of members, therefore if - the users are not already members of the project they will also become members as a result of this operation. - Returns the updated project record. - - Parameters - ---------- - project : {Gid} The project to add followers to. - [data] : {Object} Data for the request - - followers : {Array} An array of followers to add to the project. - """ - path = "/projects/%s/addFollowers" % (project) - return self.client.post(path, params, **options) - - def remove_followers(self, project, params={}, **options): - """Removes the specified list of users from following the project, this will not affect project membership status. - Returns the updated project record. - - Parameters - ---------- - project : {Gid} The project to remove followers from. - [data] : {Object} Data for the request - - followers : {Array} An array of followers to remove from the project. - """ - path = "/projects/%s/removeFollowers" % (project) - return self.client.post(path, params, **options) - - def add_members(self, project, params={}, **options): - """Adds the specified list of users as members of the project. Returns the updated project record. - - Parameters - ---------- - project : {Gid} The project to add members to. - [data] : {Object} Data for the request - - members : {Array} An array of user ids. - """ - path = "/projects/%s/addMembers" % (project) - return self.client.post(path, params, **options) - - def remove_members(self, project, params={}, **options): - """Removes the specified list of members from the project. Returns the updated project record. - - Parameters - ---------- - project : {Gid} The project to remove members from. - [data] : {Object} Data for the request - - members : {Array} An array of user ids. - """ - path = "/projects/%s/removeMembers" % (project) - return self.client.post(path, params, **options) - - def add_custom_field_setting(self, project, params={}, **options): - """Create a new custom field setting on the project. - - Parameters - ---------- - project : {Gid} The project to associate the custom field with - [data] : {Object} Data for the request - - custom_field : {Gid} The id of the custom field to associate with this project. - - [is_important] : {Boolean} Whether this field should be considered important to this project. - - [insert_before] : {Gid} An id of a Custom Field Settings on this project, before which the new Custom Field Settings will be added. - `insert_before` and `insert_after` parameters cannot both be specified. - - [insert_after] : {Gid} An id of a Custom Field Settings on this project, after which the new Custom Field Settings will be added. - `insert_before` and `insert_after` parameters cannot both be specified. - """ - path = "/projects/%s/addCustomFieldSetting" % (project) - return self.client.post(path, params, **options) - - def remove_custom_field_setting(self, project, params={}, **options): - """Remove a custom field setting on the project. - - Parameters - ---------- - project : {Gid} The project to associate the custom field with - [data] : {Object} Data for the request - - [custom_field] : {Gid} The id of the custom field to remove from this project. - """ - path = "/projects/%s/removeCustomFieldSetting" % (project) - return self.client.post(path, params, **options) - - diff --git a/asana/resources/sections.py b/asana/resources/sections.py deleted file mode 100644 index 002acedc..00000000 --- a/asana/resources/sections.py +++ /dev/null @@ -1,119 +0,0 @@ -from .gen.sections import _Sections - - -class Sections(_Sections): - """The :class:`Sections` object, which represents the resource of the same - name in Asana's API. - - """ - def create_in_project(self, project, params={}, **options): - """Creates a new section in a project. - - Returns the full record of the newly created section. - - Parameters - ---------- - project : {Gid} The project to create the section in - [data] : {Object} Data for the request - - name : {String} The text to be displayed as the section name. This cannot be an empty string. - """ - path = "/projects/%s/sections" % (project) - return self.client.post(path, params, **options) - - def find_by_project(self, project, params={}, **options): - """Returns the compact records for all sections in the specified project. - - Parameters - ---------- - project : {Gid} The project to get sections from. - [params] : {Object} Parameters for the request - """ - path = "/projects/%s/sections" % (project) - return self.client.get_collection(path, params, **options) - - def find_by_id(self, section, params={}, **options): - """Returns the complete record for a single section. - - Parameters - ---------- - section : {Gid} The section to get. - [params] : {Object} Parameters for the request - """ - path = "/sections/%s" % (section) - return self.client.get(path, params, **options) - - def update(self, section, params={}, **options): - """A specific, existing section can be updated by making a PUT request on - the URL for that project. Only the fields provided in the `data` block - will be updated; any unspecified fields will remain unchanged. (note that - at this time, the only field that can be updated is the `name` field.) - - When using this method, it is best to specify only those fields you wish - to change, or else you may overwrite changes made by another user since - you last retrieved the task. - - Returns the complete updated section record. - - Parameters - ---------- - section : {Gid} The section to update. - [data] : {Object} Data for the request - """ - path = "/sections/%s" % (section) - return self.client.put(path, params, **options) - - def delete(self, section, params={}, **options): - """A specific, existing section can be deleted by making a DELETE request - on the URL for that section. - - Note that sections must be empty to be deleted. - - The last remaining section in a board view cannot be deleted. - - Returns an empty data block. - - Parameters - ---------- - section : {Gid} The section to delete. - """ - path = "/sections/%s" % (section) - return self.client.delete(path, params, **options) - - def add_task(self, section, params={}, **options): - """Add a task to a specific, existing section. This will remove the task from other sections of the project. - - The task will be inserted at the top of a section unless an `insert_before` or `insert_after` parameter is declared. - - This does not work for separators (tasks with the `resource_subtype` of section). - - Parameters - ---------- - section : {Gid} The section to add a task to - [data] : {Object} Data for the request - - task : {Gid} The task to add to this section - - [insert_before] : {Gid} Insert the given task immediately before the task specified by this parameter. Cannot be provided together with `insert_after`. - - [insert_after] : {Gid} Insert the given task immediately after the task specified by this parameter. Cannot be provided together with `insert_before`. - """ - path = "/sections/%s/addTask" % (section) - return self.client.post(path, params, **options) - - def insert_in_project(self, project, params={}, **options): - """Move sections relative to each other in a board view. One of - `before_section` or `after_section` is required. - - Sections cannot be moved between projects. - - At this point in time, moving sections is not supported in list views, only board views. - - Returns an empty data block. - - Parameters - ---------- - project : {Gid} The project in which to reorder the given section - [data] : {Object} Data for the request - - section : {Gid} The section to reorder - - [before_section] : {Gid} Insert the given section immediately before the section specified by this parameter. - - [after_section] : {Gid} Insert the given section immediately after the section specified by this parameter. - """ - path = "/projects/%s/sections/insert" % (project) - return self.client.post(path, params, **options) diff --git a/asana/resources/status_updates.py b/asana/resources/status_updates.py deleted file mode 100644 index c061a7bb..00000000 --- a/asana/resources/status_updates.py +++ /dev/null @@ -1,6 +0,0 @@ - -from .gen.status_updates import _StatusUpdates - -class StatusUpdates(_StatusUpdates): - """Goals resource""" - pass diff --git a/asana/resources/stories.py b/asana/resources/stories.py deleted file mode 100644 index edf2913c..00000000 --- a/asana/resources/stories.py +++ /dev/null @@ -1,70 +0,0 @@ - -from .gen.stories import _Stories - -class Stories(_Stories): - """Stories resource""" - def find_by_task(self, task, params={}, **options): - """Returns the compact records for all stories on the task. - - Parameters - ---------- - task : {Gid} Globally unique identifier for the task. - [params] : {Object} Parameters for the request - """ - path = "/tasks/%s/stories" % (task) - return self.client.get_collection(path, params, **options) - - def find_by_id(self, story, params={}, **options): - """Returns the full record for a single story. - - Parameters - ---------- - story : {Gid} Globally unique identifier for the story. - [params] : {Object} Parameters for the request - """ - path = "/stories/%s" % (story) - return self.client.get(path, params, **options) - - def create_on_task(self, task, params={}, **options): - """Adds a comment to a task. The comment will be authored by the - currently authenticated user, and timestamped when the server receives - the request. - - Returns the full record for the new story added to the task. - - Parameters - ---------- - task : {Id} Globally unique identifier for the task. - [data] : {Object} Data for the request - - text : {String} The plain text of the comment to add. - """ - path = "/tasks/%s/stories" % (task) - return self.client.post(path, params, **options) - - def update(self, story, params={}, **options): - """Updates the story and returns the full record for the updated story. - Only comment stories can have their text updated, and only comment stories and - attachment stories can be pinned. Only one of `text` and `html_text` can be specified. - - Parameters - ---------- - story : {Gid} Globally unique identifier for the story. - [data] : {Object} Data for the request - - [text] : {String} The plain text with which to update the comment. - - [html_text] : {String} The rich text with which to update the comment. - - [is_pinned] : {Boolean} Whether the story should be pinned on the resource. - """ - path = "/stories/%s" % (story) - return self.client.put(path, params, **options) - - def delete(self, story, params={}, **options): - """Deletes a story. A user can only delete stories they have created. Returns an empty data record. - - Parameters - ---------- - story : {Gid} Globally unique identifier for the story. - """ - path = "/stories/%s" % (story) - return self.client.delete(path, params, **options) - - diff --git a/asana/resources/tags.py b/asana/resources/tags.py deleted file mode 100644 index 20356310..00000000 --- a/asana/resources/tags.py +++ /dev/null @@ -1,118 +0,0 @@ - -from .gen.tags import _Tags - -class Tags(_Tags): - """Tags resource""" - def create(self, params={}, **options): - """Creates a new tag in a workspace or organization. - - Every tag is required to be created in a specific workspace or - organization, and this cannot be changed once set. Note that you can use - the `workspace` parameter regardless of whether or not it is an - organization. - - Returns the full record of the newly created tag. - - Parameters - ---------- - [data] : {Object} Data for the request - - workspace : {Gid} The workspace or organization to create the tag in. - """ - return self.client.post("/tags", params, **options) - - def create_in_workspace(self, workspace, params={}, **options): - """Creates a new tag in a workspace or organization. - - Every tag is required to be created in a specific workspace or - organization, and this cannot be changed once set. Note that you can use - the `workspace` parameter regardless of whether or not it is an - organization. - - Returns the full record of the newly created tag. - - Parameters - ---------- - workspace : {Gid} The workspace or organization to create the tag in. - [data] : {Object} Data for the request - """ - path = "/workspaces/%s/tags" % (workspace) - return self.client.post(path, params, **options) - - def find_by_id(self, tag, params={}, **options): - """Returns the complete tag record for a single tag. - - Parameters - ---------- - tag : {Gid} The tag to get. - [params] : {Object} Parameters for the request - """ - path = "/tags/%s" % (tag) - return self.client.get(path, params, **options) - - def update(self, tag, params={}, **options): - """Updates the properties of a tag. Only the fields provided in the `data` - block will be updated; any unspecified fields will remain unchanged. - - When using this method, it is best to specify only those fields you wish - to change, or else you may overwrite changes made by another user since - you last retrieved the task. - - Returns the complete updated tag record. - - Parameters - ---------- - tag : {Gid} The tag to update. - [data] : {Object} Data for the request - """ - path = "/tags/%s" % (tag) - return self.client.put(path, params, **options) - - def delete(self, tag, params={}, **options): - """A specific, existing tag can be deleted by making a DELETE request - on the URL for that tag. - - Returns an empty data record. - - Parameters - ---------- - tag : {Gid} The tag to delete. - """ - path = "/tags/%s" % (tag) - return self.client.delete(path, params, **options) - - def find_all(self, params={}, **options): - """Returns the compact tag records for some filtered set of tags. - Use one or more of the parameters provided to filter the tags returned. - - Parameters - ---------- - [params] : {Object} Parameters for the request - - [workspace] : {Gid} The workspace or organization to filter tags on. - - [team] : {Gid} The team to filter tags on. - - [archived] : {Boolean} Only return tags whose `archived` field takes on the value of - this parameter. - """ - return self.client.get_collection("/tags", params, **options) - - def find_by_workspace(self, workspace, params={}, **options): - """Returns the compact tag records for all tags in the workspace. - - Parameters - ---------- - workspace : {Gid} The workspace or organization to find tags in. - [params] : {Object} Parameters for the request - """ - path = "/workspaces/%s/tags" % (workspace) - return self.client.get_collection(path, params, **options) - - def get_tasks_with_tag(self, tag, params={}, **options): - """Returns the compact task records for all tasks with the given tag. - Tasks can have more than one tag at a time. - Parameters - ---------- - tag : {Id} The tag to fetch tasks from. - [params] : {Object} Parameters for the request - """ - path = "/tags/%s/tasks" % (tag) - return self.client.get_collection(path, params, **options) - diff --git a/asana/resources/tasks.py b/asana/resources/tasks.py deleted file mode 100644 index 0f6436a6..00000000 --- a/asana/resources/tasks.py +++ /dev/null @@ -1,472 +0,0 @@ - -from .gen.tasks import _Tasks - -class Tasks(_Tasks): - """Tasks resource""" - def set_parent(self, task_id, params={}, **options): - """Changes the parent of a task. Each task may only be a subtask of a single - parent, or no parent task at all. Returns an empty data block. - - Parameters - ---------- - task : {Id} Globally unique identifier for the task. - [data] : {Object} Data for the request - - parent : {Id} The new parent of the task, or `null` for no parent. - """ - path = '/tasks/%s/setParent' % (task_id) - return self.client.post(path, params, **options) - - def create(self, params={}, **options): - """Creating a new task is as easy as POSTing to the `/tasks` endpoint - with a data block containing the fields you'd like to set on the task. - Any unspecified fields will take on default values. - - Every task is required to be created in a specific workspace, and this - workspace cannot be changed once set. The workspace need not be set - explicitly if you specify `projects` or a `parent` task instead. - - `projects` can be a comma separated list of projects, or just a single - project the task should belong to. - - Parameters - ---------- - [data] : {Object} Data for the request - - [workspace] : {Gid} The workspace to create a task in. - """ - return self.client.post("/tasks", params, **options) - - def create_in_workspace(self, workspace, params={}, **options): - """Creating a new task is as easy as POSTing to the `/tasks` endpoint - with a data block containing the fields you'd like to set on the task. - Any unspecified fields will take on default values. - - Every task is required to be created in a specific workspace, and this - workspace cannot be changed once set. The workspace need not be set - explicitly if you specify a `project` or a `parent` task instead. - - Parameters - ---------- - workspace : {Gid} The workspace to create a task in. - [data] : {Object} Data for the request - """ - path = "/workspaces/%s/tasks" % (workspace) - return self.client.post(path, params, **options) - - def find_by_id(self, task, params={}, **options): - """Returns the complete task record for a single task. - - Parameters - ---------- - task : {Gid} The task to get. - [params] : {Object} Parameters for the request - """ - path = "/tasks/%s" % (task) - return self.client.get(path, params, **options) - - def update(self, task, params={}, **options): - """A specific, existing task can be updated by making a PUT request on the - URL for that task. Only the fields provided in the `data` block will be - updated; any unspecified fields will remain unchanged. - - When using this method, it is best to specify only those fields you wish - to change, or else you may overwrite changes made by another user since - you last retrieved the task. - - Returns the complete updated task record. - - Parameters - ---------- - task : {Gid} The task to update. - [data] : {Object} Data for the request - """ - path = "/tasks/%s" % (task) - return self.client.put(path, params, **options) - - def delete(self, task, params={}, **options): - """A specific, existing task can be deleted by making a DELETE request on the - URL for that task. Deleted tasks go into the "trash" of the user making - the delete request. Tasks can be recovered from the trash within a period - of 30 days; afterward they are completely removed from the system. - - Returns an empty data record. - - Parameters - ---------- - task : {Gid} The task to delete. - """ - path = "/tasks/%s" % (task) - return self.client.delete(path, params, **options) - - def duplicate_task(self, task, params={}, **options): - """Creates and returns a job that will asynchronously handle the duplication. - - Parameters - ---------- - task : {Gid} The task to duplicate. - [data] : {Object} Data for the request - - name : {String} The name of the new task. - - [include] : {Array} The fields that will be duplicated to the new task. - """ - path = "/tasks/%s/duplicate" % (task) - return self.client.post(path, params, **options) - - def find_by_project(self, project, params={}, **options): - """Returns the compact task records for all tasks within the given project, - ordered by their priority within the project. - - Parameters - ---------- - project : {Gid} The project in which to search for tasks. - [params] : {Object} Parameters for the request - """ - path = "/projects/%s/tasks" % (project) - return self.client.get_collection(path, params, **options) - - def find_by_tag(self, tag, params={}, **options): - """Returns the compact task records for all tasks with the given tag. - - Parameters - ---------- - tag : {Gid} The tag in which to search for tasks. - [params] : {Object} Parameters for the request - """ - path = "/tags/%s/tasks" % (tag) - return self.client.get_collection(path, params, **options) - - def find_by_section(self, section, params={}, **options): - """Board view only: Returns the compact section records for all tasks within the given section. - - Parameters - ---------- - section : {Gid} The section in which to search for tasks. - [params] : {Object} Parameters for the request - """ - path = "/sections/%s/tasks" % (section) - return self.client.get_collection(path, params, **options) - - def find_by_user_task_list(self, user_task_list, params={}, **options): - """Returns the compact list of tasks in a user's My Tasks list. The returned - tasks will be in order within each assignee status group of `Inbox`, - `Today`, and `Upcoming`. - - **Note:** tasks in `Later` have a different ordering in the Asana web app - than the other assignee status groups; this endpoint will still return - them in list order in `Later` (differently than they show up in Asana, - but the same order as in Asana's mobile apps). - - **Note:** Access control is enforced for this endpoint as with all Asana - API endpoints, meaning a user's private tasks will be filtered out if the - API-authenticated user does not have access to them. - - **Note:** Both complete and incomplete tasks are returned by default - unless they are filtered out (for example, setting `completed_since=now` - will return only incomplete tasks, which is the default view for "My - Tasks" in Asana.) - - Parameters - ---------- - user_task_list : {Gid} The user task list in which to search for tasks. - [params] : {Object} Parameters for the request - - [completed_since] : {String} Only return tasks that are either incomplete or that have been - completed since this time. - """ - path = "/user_task_lists/%s/tasks" % (user_task_list) - return self.client.get_collection(path, params, **options) - - def find_all(self, params={}, **options): - """Returns the compact task records for some filtered set of tasks. Use one - or more of the parameters provided to filter the tasks returned. You must - specify a `project`, `section`, `tag`, or `user_task_list` if you do not - specify `assignee` and `workspace`. - - Parameters - ---------- - [params] : {Object} Parameters for the request - - [assignee] : {String} The assignee to filter tasks on. - - [workspace] : {Gid} The workspace or organization to filter tasks on. - - [project] : {Gid} The project to filter tasks on. - - [section] : {Gid} The section to filter tasks on. - - [tag] : {Gid} The tag to filter tasks on. - - [user_task_list] : {Gid} The user task list to filter tasks on. - - [completed_since] : {String} Only return tasks that are either incomplete or that have been - completed since this time. - - [modified_since] : {String} Only return tasks that have been modified since the given time. - """ - return self.client.get_collection("/tasks", params, **options) - - def search_in_workspace(self, workspace, params={}, **options): - """The search endpoint allows you to build complex queries to find and fetch exactly the data you need from Asana. For a more comprehensive description of all the query parameters and limitations of this endpoint, see our [long-form documentation](/developers/documentation/getting-started/search-api) for this feature. - - Parameters - ---------- - workspace : {Gid} The workspace or organization in which to search for tasks. - [params] : {Object} Parameters for the request - - [resource_subtype] : {Enum} Filters results by the task's resource_subtype. - """ - path = "/workspaces/%s/tasks/search" % (workspace) - return self.client.get_collection(path, params, **options) - - def dependencies(self, task, params={}, **options): - """Returns the compact representations of all of the dependencies of a task. - - Parameters - ---------- - task : {Gid} The task to get dependencies on. - [params] : {Object} Parameters for the request - """ - path = "/tasks/%s/dependencies" % (task) - return self.client.get(path, params, **options) - - def dependents(self, task, params={}, **options): - """Returns the compact representations of all of the dependents of a task. - - Parameters - ---------- - task : {Gid} The task to get dependents on. - [params] : {Object} Parameters for the request - """ - path = "/tasks/%s/dependents" % (task) - return self.client.get(path, params, **options) - - def add_dependencies(self, task, params={}, **options): - """Marks a set of tasks as dependencies of this task, if they are not - already dependencies. *A task can have at most 15 dependencies.* - - Parameters - ---------- - task : {Gid} The task to add dependencies to. - [data] : {Object} Data for the request - - dependencies : {Array} An array of task IDs that this task should depend on. - """ - path = "/tasks/%s/addDependencies" % (task) - return self.client.post(path, params, **options) - - def add_dependents(self, task, params={}, **options): - """Marks a set of tasks as dependents of this task, if they are not already - dependents. *A task can have at most 30 dependents.* - - Parameters - ---------- - task : {Gid} The task to add dependents to. - [data] : {Object} Data for the request - - dependents : {Array} An array of task IDs that should depend on this task. - """ - path = "/tasks/%s/addDependents" % (task) - return self.client.post(path, params, **options) - - def remove_dependencies(self, task, params={}, **options): - """Unlinks a set of dependencies from this task. - - Parameters - ---------- - task : {Gid} The task to remove dependencies from. - [data] : {Object} Data for the request - - dependencies : {Array} An array of task IDs to remove as dependencies. - """ - path = "/tasks/%s/removeDependencies" % (task) - return self.client.post(path, params, **options) - - def remove_dependents(self, task, params={}, **options): - """Unlinks a set of dependents from this task. - - Parameters - ---------- - task : {Gid} The task to remove dependents from. - [data] : {Object} Data for the request - - dependents : {Array} An array of task IDs to remove as dependents. - """ - path = "/tasks/%s/removeDependents" % (task) - return self.client.post(path, params, **options) - - def add_followers(self, task, params={}, **options): - """Adds each of the specified followers to the task, if they are not already - following. Returns the complete, updated record for the affected task. - - Parameters - ---------- - task : {Gid} The task to add followers to. - [data] : {Object} Data for the request - - followers : {Array} An array of followers to add to the task. - """ - path = "/tasks/%s/addFollowers" % (task) - return self.client.post(path, params, **options) - - def remove_followers(self, task, params={}, **options): - """Removes each of the specified followers from the task if they are - following. Returns the complete, updated record for the affected task. - - Parameters - ---------- - task : {Gid} The task to remove followers from. - [data] : {Object} Data for the request - - followers : {Array} An array of followers to remove from the task. - """ - path = "/tasks/%s/removeFollowers" % (task) - return self.client.post(path, params, **options) - - def projects(self, task, params={}, **options): - """Returns a compact representation of all of the projects the task is in. - - Parameters - ---------- - task : {Gid} The task to get projects on. - [params] : {Object} Parameters for the request - """ - path = "/tasks/%s/projects" % (task) - return self.client.get_collection(path, params, **options) - - def add_project(self, task, params={}, **options): - """Adds the task to the specified project, in the optional location - specified. If no location arguments are given, the task will be added to - the end of the project. - - `addProject` can also be used to reorder a task within a project or section that - already contains it. - - At most one of `insert_before`, `insert_after`, or `section` should be - specified. Inserting into a section in an non-order-dependent way can be - done by specifying `section`, otherwise, to insert within a section in a - particular place, specify `insert_before` or `insert_after` and a task - within the section to anchor the position of this task. - - Returns an empty data block. - - Parameters - ---------- - task : {Gid} The task to add to a project. - [data] : {Object} Data for the request - - project : {Gid} The project to add the task to. - - [insert_after] : {Gid} A task in the project to insert the task after, or `null` to - insert at the beginning of the list. - - [insert_before] : {Gid} A task in the project to insert the task before, or `null` to - insert at the end of the list. - - [section] : {Gid} A section in the project to insert the task into. The task will be - inserted at the bottom of the section. - """ - path = "/tasks/%s/addProject" % (task) - return self.client.post(path, params, **options) - - def remove_project(self, task, params={}, **options): - """Removes the task from the specified project. The task will still exist - in the system, but it will not be in the project anymore. - - Returns an empty data block. - - Parameters - ---------- - task : {Gid} The task to remove from a project. - [data] : {Object} Data for the request - - project : {Gid} The project to remove the task from. - """ - path = "/tasks/%s/removeProject" % (task) - return self.client.post(path, params, **options) - - def tags(self, task, params={}, **options): - """Returns a compact representation of all of the tags the task has. - - Parameters - ---------- - task : {Gid} The task to get tags on. - [params] : {Object} Parameters for the request - """ - path = "/tasks/%s/tags" % (task) - return self.client.get_collection(path, params, **options) - - def add_tag(self, task, params={}, **options): - """Adds a tag to a task. Returns an empty data block. - - Parameters - ---------- - task : {Gid} The task to add a tag to. - [data] : {Object} Data for the request - - tag : {Gid} The tag to add to the task. - """ - path = "/tasks/%s/addTag" % (task) - return self.client.post(path, params, **options) - - def remove_tag(self, task, params={}, **options): - """Removes a tag from the task. Returns an empty data block. - - Parameters - ---------- - task : {Gid} The task to remove a tag from. - [data] : {Object} Data for the request - - tag : {Gid} The tag to remove from the task. - """ - path = "/tasks/%s/removeTag" % (task) - return self.client.post(path, params, **options) - - def subtasks(self, task, params={}, **options): - """Returns a compact representation of all of the subtasks of a task. - - Parameters - ---------- - task : {Gid} The task to get the subtasks of. - [params] : {Object} Parameters for the request - """ - path = "/tasks/%s/subtasks" % (task) - return self.client.get_collection(path, params, **options) - - def add_subtask(self, task, params={}, **options): - """Creates a new subtask and adds it to the parent task. Returns the full record - for the newly created subtask. - - Parameters - ---------- - task : {Gid} The task to add a subtask to. - [data] : {Object} Data for the request - """ - path = "/tasks/%s/subtasks" % (task) - return self.client.post(path, params, **options) - - def stories(self, task, params={}, **options): - """Returns a compact representation of all of the stories on the task. - - Parameters - ---------- - task : {Gid} The task containing the stories to get. - [params] : {Object} Parameters for the request - """ - path = "/tasks/%s/stories" % (task) - return self.client.get_collection(path, params, **options) - - def add_comment(self, task, params={}, **options): - """Adds a comment to a task. The comment will be authored by the - currently authenticated user, and timestamped when the server receives - the request. - - Returns the full record for the new story added to the task. - - Parameters - ---------- - task : {Id} Globally unique identifier for the task. - [data] : {Object} Data for the request - - text : {String} The plain text of the comment to add. - """ - path = "/tasks/%s/stories" % (task) - return self.client.post(path, params, **options) - - def insert_in_user_task_list(self, user_task_list, params={}, **options): - """Insert or reorder tasks in a user's My Tasks list. If the task was not - assigned to the owner of the user task list it will be reassigned when - this endpoint is called. If neither `insert_before` nor `insert_after` - are provided the task will be inserted at the top of the assignee's - inbox. - - Returns an empty data block. - - Parameters - ---------- - user_task_list : {Gid} Globally unique identifier for the user task list. - [data] : {Object} Data for the request - - task : {Gid} Globally unique identifier for the task. - - [insert_before] : {Gid} Insert the task before the task specified by this field. The inserted - task will inherit the `assignee_status` of this task. `insert_before` - and `insert_after` parameters cannot both be specified. - - [insert_after] : {Gid} Insert the task after the task specified by this field. The inserted - task will inherit the `assignee_status` of this task. `insert_before` - and `insert_after` parameters cannot both be specified. - """ - path = "/user_task_lists/%s/tasks/insert" % (user_task_list) - return self.client.post(path, params, **options) - diff --git a/asana/resources/team_memberships.py b/asana/resources/team_memberships.py deleted file mode 100644 index b3bba790..00000000 --- a/asana/resources/team_memberships.py +++ /dev/null @@ -1,6 +0,0 @@ - -from .gen.team_memberships import _TeamMemberships - -class TeamMemberships(_TeamMemberships): - """TeamMemberships resource""" - pass diff --git a/asana/resources/teams.py b/asana/resources/teams.py deleted file mode 100644 index 737f7374..00000000 --- a/asana/resources/teams.py +++ /dev/null @@ -1,86 +0,0 @@ - -from .gen.teams import _Teams - -class Teams(_Teams): - """Teams resource""" - def find_by_id(self, team, params={}, **options): - """Returns the full record for a single team. - - Parameters - ---------- - team : {Id} Globally unique identifier for the team. - [params] : {Object} Parameters for the request - """ - path = "/teams/%s" % (team) - return self.client.get(path, params, **options) - - def find_by_organization(self, organization, params={}, **options): - """Returns the compact records for all teams in the organization visible to - the authorized user. - - Parameters - ---------- - organization : {Id} Globally unique identifier for the workspace or organization. - [params] : {Object} Parameters for the request - """ - path = "/organizations/%s/teams" % (organization) - return self.client.get_collection(path, params, **options) - - def find_by_user(self, user, params={}, **options): - """Returns the compact records for all teams to which user is assigned. - - Parameters - ---------- - user : {String} An identifier for the user. Can be one of an email address, - the globally unique identifier for the user, or the keyword `me` - to indicate the current user making the request. - [params] : {Object} Parameters for the request - - [organization] : {Id} The workspace or organization to filter teams on. - """ - path = "/users/%s/teams" % (user) - return self.client.get_collection(path, params, **options) - - def users(self, team, params={}, **options): - """Returns the compact records for all users that are members of the team. - - Parameters - ---------- - team : {Id} Globally unique identifier for the team. - [params] : {Object} Parameters for the request - """ - path = "/teams/%s/users" % (team) - return self.client.get_collection(path, params, **options) - - def add_user(self, team, params={}, **options): - """The user making this call must be a member of the team in order to add others. - The user to add must exist in the same organization as the team in order to be added. - The user to add can be referenced by their globally unique user ID or their email address. - Returns the full user record for the added user. - - Parameters - ---------- - team : {Id} Globally unique identifier for the team. - [data] : {Object} Data for the request - - user : {String} An identifier for the user. Can be one of an email address, - the globally unique identifier for the user, or the keyword `me` - to indicate the current user making the request. - """ - path = "/teams/%s/addUser" % (team) - return self.client.post(path, params, **options) - - def remove_user(self, team, params={}, **options): - """The user to remove can be referenced by their globally unique user ID or their email address. - Removes the user from the specified team. Returns an empty data record. - - Parameters - ---------- - team : {Id} Globally unique identifier for the team. - [data] : {Object} Data for the request - - user : {String} An identifier for the user. Can be one of an email address, - the globally unique identifier for the user, or the keyword `me` - to indicate the current user making the request. - """ - path = "/teams/%s/removeUser" % (team) - return self.client.post(path, params, **options) - - diff --git a/asana/resources/time_periods.py b/asana/resources/time_periods.py deleted file mode 100644 index 1980735b..00000000 --- a/asana/resources/time_periods.py +++ /dev/null @@ -1,6 +0,0 @@ - -from .gen.time_periods import _TimePeriods - -class TimePeriods(_TimePeriods): - """TimePeriods resource""" - pass diff --git a/asana/resources/typeahead.py b/asana/resources/typeahead.py deleted file mode 100644 index bfb36814..00000000 --- a/asana/resources/typeahead.py +++ /dev/null @@ -1,6 +0,0 @@ - -from .gen.typeahead import _Typeahead - -class Typeahead(_Typeahead): - """Typeahead resource""" - pass diff --git a/asana/resources/user_task_lists.py b/asana/resources/user_task_lists.py deleted file mode 100644 index db4a3b70..00000000 --- a/asana/resources/user_task_lists.py +++ /dev/null @@ -1,60 +0,0 @@ - -from .gen.user_task_lists import _UserTaskLists - -class UserTaskLists(_UserTaskLists): - """User Task Lists resource""" - def find_by_user(self, user, params={}, **options): - """Returns the full record for the user task list for the given user - - Parameters - ---------- - user : {String} An identifier for the user. Can be one of an email address, - the globally unique identifier for the user, or the keyword `me` - to indicate the current user making the request. - [params] : {Object} Parameters for the request - - workspace : {Gid} Globally unique identifier for the workspace or organization. - """ - path = "/users/%s/user_task_list" % (user) - return self.client.get(path, params, **options) - - def find_by_id(self, user_task_list, params={}, **options): - """Returns the full record for a user task list. - - Parameters - ---------- - user_task_list : {Gid} Globally unique identifier for the user task list. - [params] : {Object} Parameters for the request - """ - path = "/user_task_lists/%s" % (user_task_list) - return self.client.get(path, params, **options) - - def tasks(self, user_task_list, params={}, **options): - """Returns the compact list of tasks in a user's My Tasks list. The returned - tasks will be in order within each assignee status group of `Inbox`, - `Today`, and `Upcoming`. - - **Note:** tasks in `Later` have a different ordering in the Asana web app - than the other assignee status groups; this endpoint will still return - them in list order in `Later` (differently than they show up in Asana, - but the same order as in Asana's mobile apps). - - **Note:** Access control is enforced for this endpoint as with all Asana - API endpoints, meaning a user's private tasks will be filtered out if the - API-authenticated user does not have access to them. - - **Note:** Both complete and incomplete tasks are returned by default - unless they are filtered out (for example, setting `completed_since=now` - will return only incomplete tasks, which is the default view for "My - Tasks" in Asana.) - - Parameters - ---------- - user_task_list : {Gid} The user task list in which to search for tasks. - [params] : {Object} Parameters for the request - - [completed_since] : {String} Only return tasks that are either incomplete or that have been - completed since this time. - """ - path = "/user_task_lists/%s/tasks" % (user_task_list) - return self.client.get_collection(path, params, **options) - - diff --git a/asana/resources/users.py b/asana/resources/users.py deleted file mode 100644 index 98ab7b97..00000000 --- a/asana/resources/users.py +++ /dev/null @@ -1,68 +0,0 @@ - -from .gen.users import _Users - -class Users(_Users): - """Users resource""" - def me(self, params={}, **options): - """Returns the full user record for the currently authenticated user. - - Parameters - ---------- - [params] : {Object} Parameters for the request - """ - return self.client.get("/users/me", params, **options) - - def find_by_id(self, user, params={}, **options): - """Returns the full user record for the single user with the provided ID. - - Parameters - ---------- - user : {String} An identifier for the user. Can be one of an email address, - the globally unique identifier for the user, or the keyword `me` - to indicate the current user making the request. - [params] : {Object} Parameters for the request - """ - path = "/users/%s" % (user) - return self.client.get(path, params, **options) - - def get_user_favorites(self, user, params={}, **options): - """Returns all of a user's favorites in the given workspace, of the given type. - Results are given in order (The same order as Asana's sidebar). - - Parameters - ---------- - user : {String} An identifier for the user. Can be one of an email address, - the globally unique identifier for the user, or the keyword `me` - to indicate the current user making the request. - [params] : {Object} Parameters for the request - - workspace : {Id} The workspace in which to get favorites. - - resource_type : {Enum} The resource type of favorites to be returned. - """ - path = "/users/%s/favorites" % (user) - return self.client.get_collection(path, params, **options) - - def find_by_workspace(self, workspace, params={}, **options): - """Returns the user records for all users in the specified workspace or - organization. - - Parameters - ---------- - workspace : {Id} The workspace in which to get users. - [params] : {Object} Parameters for the request - """ - path = "/workspaces/%s/users" % (workspace) - return self.client.get_collection(path, params, **options) - - def find_all(self, params={}, **options): - """Returns the user records for all users in all workspaces and organizations - accessible to the authenticated user. Accepts an optional workspace ID - parameter. - - Parameters - ---------- - [params] : {Object} Parameters for the request - - [workspace] : {Id} The workspace or organization to filter users on. - """ - return self.client.get_collection("/users", params, **options) - - diff --git a/asana/resources/webhooks.py b/asana/resources/webhooks.py deleted file mode 100644 index 25e79536..00000000 --- a/asana/resources/webhooks.py +++ /dev/null @@ -1,64 +0,0 @@ - -from .gen.webhooks import _Webhooks - -class Webhooks(_Webhooks): - """Webhooks resource""" - def create(self, params={}, **options): - """Establishing a webhook is a two-part process. First, a simple HTTP POST - similar to any other resource creation. Since you could have multiple - webhooks we recommend specifying a unique local id for each target. - - Next comes the confirmation handshake. When a webhook is created, we will - send a test POST to the `target` with an `X-Hook-Secret` header as - described in the - [Resthooks Security documentation](http://resthooks.org/docs/security/). - The target must respond with a `200 OK` and a matching `X-Hook-Secret` - header to confirm that this webhook subscription is indeed expected. - - If you do not acknowledge the webhook's confirmation handshake it will - fail to setup, and you will receive an error in response to your attempt - to create it. This means you need to be able to receive and complete the - webhook *while* the POST request is in-flight. - - Parameters - ---------- - resource : {Id} A resource ID to subscribe to. The resource can be a task or project. - target : {String} The URL to receive the HTTP POST. - [data] : {Object} Data for the request - """ - return self.client.post("/webhooks", params, **options) - - def get_all(self, params={}, **options): - """Returns the compact representation of all webhooks your app has - registered for the authenticated user in the given workspace. - - Parameters - ---------- - workspace : {Id} The workspace to query for webhooks in. - [params] : {Object} Parameters for the request - - [resource] : {Id} Only return webhooks for the given resource. - """ - return self.client.get_collection("/webhooks", params, **options) - - def get_by_id(self, webhook, params={}, **options): - """Returns the full record for the given webhook. - - Parameters - ---------- - webhook : {Id} The webhook to get. - [params] : {Object} Parameters for the request - """ - path = "/webhooks/%s" % (webhook) - return self.client.get(path, params, **options) - - def delete_by_id(self, webhook, params={}, **options): - """This method permanently removes a webhook. Note that it may be possible - to receive a request that was already in flight after deleting the - webhook, but no further requests will be issued. - - Parameters - ---------- - webhook : {Id} The webhook to delete. - """ - path = "/webhooks/%s" % (webhook) - return self.client.delete(path, params, **options) diff --git a/asana/resources/workspace_memberships.py b/asana/resources/workspace_memberships.py deleted file mode 100644 index daecf713..00000000 --- a/asana/resources/workspace_memberships.py +++ /dev/null @@ -1,6 +0,0 @@ - -from .gen.workspace_memberships import _WorkspaceMemberships - -class WorkspaceMemberships(_WorkspaceMemberships): - """WorkspaceMemberships resource""" - pass diff --git a/asana/resources/workspaces.py b/asana/resources/workspaces.py deleted file mode 100644 index c1fd2166..00000000 --- a/asana/resources/workspaces.py +++ /dev/null @@ -1,97 +0,0 @@ - -from .gen.workspaces import _Workspaces - -class Workspaces(_Workspaces): - """Workspaces resource""" - def find_by_id(self, workspace, params={}, **options): - """Returns the full workspace record for a single workspace. - - Parameters - ---------- - workspace : {Id} Globally unique identifier for the workspace or organization. - [params] : {Object} Parameters for the request - """ - path = "/workspaces/%s" % (workspace) - return self.client.get(path, params, **options) - - def find_all(self, params={}, **options): - """Returns the compact records for all workspaces visible to the authorized user. - - Parameters - ---------- - [params] : {Object} Parameters for the request - """ - return self.client.get_collection("/workspaces", params, **options) - - def update(self, workspace, params={}, **options): - """A specific, existing workspace can be updated by making a PUT request on - the URL for that workspace. Only the fields provided in the data block - will be updated; any unspecified fields will remain unchanged. - - Currently the only field that can be modified for a workspace is its `name`. - - Returns the complete, updated workspace record. - - Parameters - ---------- - workspace : {Id} The workspace to update. - [data] : {Object} Data for the request - """ - path = "/workspaces/%s" % (workspace) - return self.client.put(path, params, **options) - - def typeahead(self, workspace, params={}, **options): - """Retrieves objects in the workspace based on an auto-completion/typeahead - search algorithm. This feature is meant to provide results quickly, so do - not rely on this API to provide extremely accurate search results. The - result set is limited to a single page of results with a maximum size, - so you won't be able to fetch large numbers of results. - - Parameters - ---------- - workspace : {Id} The workspace to fetch objects from. - [params] : {Object} Parameters for the request - - resource_type : {Enum} The type of values the typeahead should return. You can choose from - one of the following: custom_field, project, tag, task, and user. - Note that unlike in the names of endpoints, the types listed here are - in singular form (e.g. `task`). Using multiple types is not yet supported. - - [type] : {Enum} **Deprecated: new integrations should prefer the resource_type field.** - - [query] : {String} The string that will be used to search for relevant objects. If an - empty string is passed in, the API will currently return an empty - result set. - - [count] : {Number} The number of results to return. The default is `20` if this - parameter is omitted, with a minimum of `1` and a maximum of `100`. - If there are fewer results found than requested, all will be returned. - """ - path = "/workspaces/%s/typeahead" % (workspace) - return self.client.get_collection(path, params, **options) - - def add_user(self, workspace, params={}, **options): - """The user can be referenced by their globally unique user ID or their email address. - Returns the full user record for the invited user. - - Parameters - ---------- - workspace : {Id} The workspace or organization to invite the user to. - [data] : {Object} Data for the request - - user : {String} An identifier for the user. Can be one of an email address, - the globally unique identifier for the user, or the keyword `me` - to indicate the current user making the request. - """ - path = "/workspaces/%s/addUser" % (workspace) - return self.client.post(path, params, **options) - - def remove_user(self, workspace, params={}, **options): - """The user making this call must be an admin in the workspace. - Returns an empty data record. - - Parameters - ---------- - workspace : {Id} The workspace or organization to invite the user to. - [data] : {Object} Data for the request - - user : {String} An identifier for the user. Can be one of an email address, - the globally unique identifier for the user, or the keyword `me` - to indicate the current user making the request. - """ - path = "/workspaces/%s/removeUser" % (workspace) - return self.client.post(path, params, **options) diff --git a/asana/session.py b/asana/session.py deleted file mode 100644 index 1d0276ce..00000000 --- a/asana/session.py +++ /dev/null @@ -1,20 +0,0 @@ -import requests -import requests_oauthlib - -class AsanaOAuth2Session(requests_oauthlib.OAuth2Session): - """Session class for making OAuth authenticated requests to Asana's API""" - - authorize_url = 'https://app.asana.com/-/oauth_authorize' - token_url = 'https://app.asana.com/-/oauth_token' - - def __init__(self, client_secret=None, **kwargs): - super(AsanaOAuth2Session, self).__init__(**kwargs) - self.client_secret = client_secret - - def authorization_url(self): - """Get a URL (and 'state' token) to redirect the user to for authentication""" - return super(AsanaOAuth2Session, self).authorization_url(self.authorize_url) - - def fetch_token(self, **kwargs): - """Exchange a code (and 'state' token) for a bearer token""" - return super(AsanaOAuth2Session, self).fetch_token(self.token_url, client_secret=self.client_secret, **kwargs) diff --git a/asana/version.py b/asana/version.py deleted file mode 100644 index 29e4a941..00000000 --- a/asana/version.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = '3.2.2' diff --git a/codegen/swagger/README.md b/codegen/swagger/README.md new file mode 100644 index 00000000..ca6b3110 --- /dev/null +++ b/codegen/swagger/README.md @@ -0,0 +1,74 @@ +# Swagger Codegen for the AsanaPythonClientCodegen library + +## Overview +This is a boiler-plate project to generate your own client library with Swagger. Its goal is +to get you started with the basic plumbing so you can put in your own logic. It won't work without +your changes applied. + +## What's Swagger? +The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service. + + +Check out [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the Swagger project, including additional libraries with support for other languages and more. + +## How do I use this? +At this point, you've likely generated a client setup. It will include something along these lines: + +``` +. +|- README.md // this file +|- pom.xml // build script +|-- src +|--- main +|---- java +|----- com.asana.codegen.AsanaPythonClientCodegenGenerator.java // generator file +|---- resources +|----- AsanaPythonClientCodegen // template files +|----- META-INF +|------ services +|------- io.swagger.codegen.CodegenConfig +``` + +You _will_ need to make changes in at least the following: + +`AsanaPythonClientCodegenGenerator.java` + +Templates in this folder: + +`src/main/resources/AsanaPythonClientCodegen` + +Once modified, you can run this: + +``` +mvn package +``` + +In your generator project. A single jar file will be produced in `target`. You can now use that with codegen: + +``` +java -cp /path/to/swagger-codegen-cli.jar:/path/to/your.jar io.swagger.codegen.v3.cli.SwaggerCodegen -l AsanaPythonClientCodegen -i /path/to/swagger.yaml -o ./test +``` + +Now your templates are available to the client generator and you can write output values + +## But how do I modify this? +The `ReadMe.java` has comments in it--lots of comments. There is no good substitute +for reading the code more, though. See how the `ReadMe` implements `CodegenConfig`. +That class has the signature of all values that can be overridden. + +For the templates themselves, you have a number of values available to you for generation. +You can execute the `java` command from above while passing different debug flags to show +the object you have available during client generation: + +``` +# The following additional debug options are available for all codegen targets: +# -DdebugSwagger prints the OpenAPI Specification as interpreted by the codegen +# -DdebugModels prints models passed to the template engine +# -DdebugOperations prints operations passed to the template engine +# -DdebugSupportingFiles prints additional data passed to the template engine + +java -DdebugOperations -cp /path/to/swagger-codegen-cli.jar:/path/to/your.jar io.swagger.codegen.Codegen -l AsanaPythonClientCodegen -i /path/to/swagger.yaml -o ./test +``` + +Will, for example, output the debug info for operations. You can use this info +in the `api.mustache` file. diff --git a/codegen/swagger/pom.xml b/codegen/swagger/pom.xml new file mode 100644 index 00000000..edd08158 --- /dev/null +++ b/codegen/swagger/pom.xml @@ -0,0 +1,129 @@ + + 4.0.0 + io.swagger + AsanaClientCodegen-swagger-codegen + jar + AsanaClientCodegen-swagger-codegen + 1.0.0 + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + pertest + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + jar + test-jar + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + ${build-helper-maven-plugin} + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + 1.8 + 1.8 + + + + + + + io.swagger.codegen.v3 + swagger-codegen + ${swagger-codegen-version} + provided + + + io.swagger.codegen.v3 + swagger-codegen-generators + ${swagger-codegen-generators-version} + provided + + + + UTF-8 + 3.0.44 + 1.0.41 + 1.0.0 + 4.13.1 + 3.0.0 + + diff --git a/codegen/swagger/src/main/java/com/asana/codegen/ExampleUtility.java b/codegen/swagger/src/main/java/com/asana/codegen/ExampleUtility.java new file mode 100644 index 00000000..634e95c0 --- /dev/null +++ b/codegen/swagger/src/main/java/com/asana/codegen/ExampleUtility.java @@ -0,0 +1,27 @@ +package com.asana.codegen; + +import org.json.*; +import io.swagger.codegen.v3.*; + +class ExampleUtility { + public static void tryToSetExample(CodegenParameter p) { + JSONObject obj = new JSONObject(p.jsonSchema); + + if (obj.has("example")) { + p.example = obj.get("example").toString(); + return; + } + + if (!obj.has("schema")) { + return; + } + + JSONObject schema = obj.getJSONObject("schema"); + + if (!schema.has("example")) { + return; + } + + p.example = schema.get("example").toString(); + } +} diff --git a/codegen/swagger/src/main/java/com/asana/codegen/PythonClientCodegenGenerator.java b/codegen/swagger/src/main/java/com/asana/codegen/PythonClientCodegenGenerator.java new file mode 100644 index 00000000..8b06b6dd --- /dev/null +++ b/codegen/swagger/src/main/java/com/asana/codegen/PythonClientCodegenGenerator.java @@ -0,0 +1,195 @@ +package com.asana.codegen; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.codegen.v3.*; +import io.swagger.codegen.v3.generators.python.*; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.media.Schema; + +public class PythonClientCodegenGenerator extends PythonClientCodegen { + public PythonClientCodegenGenerator() { + super(); + // Let the generator know about our code samples template so it can generate examples for our developer docs + apiDocTemplateFiles.put("code_samples.mustache", ".yaml"); + + // Remove model template files so that the generator does not generate models + modelTemplateFiles.remove("model.mustache"); + modelTestTemplateFiles.remove("model_test.mustache"); + modelDocTemplateFiles.remove("model_doc.mustache"); + } + + @Override + public void processOpts() { + // Custom generators do not set the CodegenConstants + additionalProperties.put(CodegenConstants.PACKAGE_NAME, "asana"); + setPackageName("asana"); + + additionalProperties.put(CodegenConstants.PROJECT_NAME, "asana"); + setProjectName("asana"); + + super.processOpts(); + + // Remove /models folder and /models/__init__.py file from generation + final String packageFolder = packageName.replace('.', File.separatorChar); + supportingFiles.remove(new SupportingFile("__init__model.mustache", packageFolder + File.separatorChar + "models", "__init__.py")); + + // Create a definition for collection to be used in pagination + supportingFiles.add(new SupportingFile("__init__pagination.mustache", packageFolder + File.separatorChar + "pagination", "__init__.py")); + supportingFiles.add(new SupportingFile("page_iterator.mustache", packageFolder + File.separatorChar + "pagination", "page_iterator.py")); + supportingFiles.add(new SupportingFile("event_iterator.mustache", packageFolder + File.separatorChar + "pagination", "event_iterator.py")); + } + + @Override + public String toVarName(String name) { + // Return the name as defined in the OAS rather than formatting it. EX: instead of returning modified_on_after -> modified_on.after + return name; + } + + @Override + public void setParameterExampleValue(CodegenParameter p) { + // Our example correction code must execute before super, to ensure that + // super does its special magic of determining the example type: + // https://github.com/swagger-api/swagger-codegen-generators/blob/master/src/main/java/io/swagger/codegen/v3/generators/python/PythonClientCodegen.java#L639 + ExampleUtility.tryToSetExample(p); + + String example; + if (p.defaultValue == null) { + example = p.example; + } else { + example = p.defaultValue; + } + + String type = p.baseType; + if (type == null) { + type = p.dataType; + } + + if ("String".equals(type) || "str".equalsIgnoreCase(type)) { + if (example == null) { + example = p.paramName + "_example"; + } + // Change opt_fields example from ["param1", "param2"] -> "param1,param2" + String cleanedInput = example.replace("[", "").replace("]", "").replace("\"", ""); + String[] fields = cleanedInput.split(","); + String exampleOptFieldString = String.join(",", fields); + p.example = "\"" + exampleOptFieldString + "\""; + return; + } else if ("BOOLEAN".equalsIgnoreCase(type) || "bool".equalsIgnoreCase(type)) { + // Fix boolean example showing wrong python boolean type EX: "false" instead of "False" + // p.example is a string "true" or "false". We'll need to capitalize the first letter so that the sample code in python show True or False value + p.example = p.example.substring(0, 1).toUpperCase() + p.example.substring(1); + return; + } + + // Update example value for requests that require a request body + if (!languageSpecificPrimitives.contains(type)) { + // Type is a model class, e.g. User + p.example = "{\"data\": {\"param1\": \"value1\", \"param2\": \"value2\",}}"; + p.dataType = "dict"; + return; + } + + super.setParameterExampleValue(p); + } + + @Override + public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map schemas, OpenAPI openAPI) { + CodegenOperation op = super.fromOperation(path, httpMethod, operation, schemas, openAPI); + // Set vendor-extension to be used in code_sample.mustache template to show how to use custom field query param in examples: + if(op.operationId.equalsIgnoreCase("search_tasks_for_workspace")) { + op.vendorExtensions.put("x-codegen-isSearchTasksForWorkspace", true); + } + + // Set vendor-extension to be used in api.mustache to import the event iterator if the endpoint is the /events endpoint + op.vendorExtensions.put("x-codegen-isGetEvents", op.operationId.equalsIgnoreCase("get_events")); + + // Convert operatioId from snake case to lower case string with no underscores. EX: get_custom_field_settings_for_project -> getcustomfieldsettingsforproject + // This will be used to build the link to link to the developer documentation for that particular operation + op.vendorExtensions.put("x-codegen-operationIdLowerCase", op.operationId.replace("_", "").toLowerCase()); + + // Check if the returnType has "Array" in the name EX: TaskResponseArray + // This will be used to check if an endpoint should return a collection object or not + op.vendorExtensions.put("x-codegen-isArrayResponse", op.returnType.contains("Array")); + + // Generate resource instance variable name from the tag. EX: custom_field_settings -> custom_field_settings_api_instance + String resourceInstanceName = generateResourceInstanceName(operation.getTags().get(0)); + op.vendorExtensions.put("x-codegen-resourceInstanceName", resourceInstanceName); + + // Fix PUT endpoints not adding comma in method request for sample docs. EX: .update_task(bodytask_gid, opts) -> .update_task(body, task_gid, opts) + // Make a copy of parameters to be used in the template (templateParams). This is a hacky work around. We noticed that the below code "p.vendorExtensions.put" + // does not update the parameter's vendorExtensions for POST and PUT endpoints so to work around this we created a new list that does have those + // vendorExtensions added + List templateParams = new ArrayList(); + CodegenParameter lastRequired = null; + CodegenParameter lastOptional = null; + for (CodegenParameter p : op.allParams) { + if (p.required) { + lastRequired = p; + } else { + lastOptional = p; + } + } + + // Set vendor-extension to be used in template: + // x-codegen-hasMoreRequired + // x-codegen-hasMoreOptional + // x-codegen-hasRequiredParams + for (CodegenParameter p : op.allParams) { + if (p == lastRequired) { + p.vendorExtensions.put("x-codegen-hasMoreRequired", false); + } else if (p == lastOptional) { + p.vendorExtensions.put("x-codegen-hasMoreOptional", false); + } else { + p.vendorExtensions.put("x-codegen-hasMoreRequired", true); + p.vendorExtensions.put("x-codegen-hasMoreOptional", true); + } + templateParams.add(p.copy()); + } + op.vendorExtensions.put("x-codegen-hasRequiredParams", lastRequired != null); + op.vendorExtensions.put("x-codegen-templateParams",templateParams); + + return op; + } + + static String generateResourceInstanceName(String inputString) { + String snakeCaseString = inputString.replaceAll("\\s+", "_").toLowerCase(); + + // Add "ApiInstance" to the end of the string + return snakeCaseString.toString() + "_api_instance"; + } + + @SuppressWarnings("unchecked") + @Override + public Map postProcessOperations(Map objs) { + // Generate and store argument list string of each operation into + // vendor-extension: x-codegen-arg-list. + Map operations = (Map) objs.get("operations"); + if (operations != null) { + List ops = (List) operations.get("operation"); + for (CodegenOperation operation : ops) { + List argList = new ArrayList(); + boolean hasOptionalParams = false; + for (CodegenParameter p : operation.allParams) { + if (p.required) { + argList.add(p.paramName); + } else { + hasOptionalParams = true; + } + } + if (hasOptionalParams) { + argList.add("opts"); + } + operation.vendorExtensions.put("x-codegen-arg-list", StringUtils.join(argList, ", ")); + } + } + return objs; + } +} diff --git a/codegen/swagger/src/main/java/com/asana/codegen/ReadMe.java b/codegen/swagger/src/main/java/com/asana/codegen/ReadMe.java new file mode 100644 index 00000000..749193ac --- /dev/null +++ b/codegen/swagger/src/main/java/com/asana/codegen/ReadMe.java @@ -0,0 +1,164 @@ +package com.asana.codegen; + +import io.swagger.codegen.v3.*; +import io.swagger.codegen.v3.generators.DefaultCodegenConfig; + +import java.util.*; +import java.io.File; + +public class ReadMe extends DefaultCodegenConfig { + + // source folder where to write the files + protected String sourceFolder = "src"; + protected String apiVersion = "1.0.0"; + + /** + * Configures the type of generator. + * + * @return the CodegenType for this generator + * @see io.swagger.codegen.CodegenType + */ + public CodegenType getTag() { + return CodegenType.CLIENT; + } + + /** + * Configures a friendly name for the generator. This will be used by the generator + * to select the library with the -l flag. + * + * @return the friendly name for the generator + */ + public String getName() { + return "AsanaPythonClientCodegen"; + } + + /** + * Returns human-friendly help for the generator. Provide the consumer with help + * tips, parameters here + * + * @return A string value for the help message + */ + public String getHelp() { + return "Generates a AsanaPythonClientCodegen client library."; + } + + public ReadMe() { + super(); + + // set the output folder here + outputFolder = "generated-code/AsanaPythonClientCodegen"; + + /** + * Models. You can write model files using the modelTemplateFiles map. + * if you want to create one template for file, you can do so here. + * for multiple files for model, just put another entry in the `modelTemplateFiles` with + * a different extension + */ + modelTemplateFiles.put( + "model.mustache", // the template to use + ".sample"); // the extension for each file to write + + /** + * Api classes. You can write classes for each Api file with the apiTemplateFiles map. + * as with models, add multiple entries with different extensions for multiple files per + * class + */ + apiTemplateFiles.put( + "api.mustache", // the template to use + ".sample"); // the extension for each file to write + + /** + * Template Location. This is the location which templates will be read from. The generator + * will use the resource stream to attempt to read the templates. + */ + templateDir = "AsanaPythonClientCodegen"; + + /** + * Api Package. Optional, if needed, this can be used in templates + */ + apiPackage = "io.swagger.client.api"; + + /** + * Model Package. Optional, if needed, this can be used in templates + */ + modelPackage = "io.swagger.client.model"; + + /** + * Reserved words. Override this with reserved words specific to your language + */ + reservedWords = new HashSet ( + Arrays.asList( + "sample1", // replace with static values + "sample2") + ); + + /** + * Additional Properties. These values can be passed to the templates and + * are available in models, apis, and supporting files + */ + additionalProperties.put("apiVersion", apiVersion); + + /** + * Supporting Files. You can write single files for the generator with the + * entire object tree available. If the input file has a suffix of `.mustache + * it will be processed by the template engine. Otherwise, it will be copied + */ + supportingFiles.add(new SupportingFile("myFile.mustache", // the input template or file + "", // the destination folder, relative `outputFolder` + "myFile.sample") // the output file + ); + + /** + * Language Specific Primitives. These types will not trigger imports by + * the client generator + */ + languageSpecificPrimitives = new HashSet( + Arrays.asList( + "Type1", // replace these with your types + "Type2") + ); + } + + /** + * Escapes a reserved word as defined in the `reservedWords` array. Handle escaping + * those terms here. This logic is only called if a variable matches the reserved words + * + * @return the escaped term + */ + @Override + public String escapeReservedWord(String name) { + return "_" + name; // add an underscore to the name + } + + /** + * Location to write model files. You can use the modelPackage() as defined when the class is + * instantiated + */ + public String modelFileFolder() { + return outputFolder + "/" + sourceFolder + "/" + modelPackage().replace('.', File.separatorChar); + } + + /** + * Location to write api files. You can use the apiPackage() as defined when the class is + * instantiated + */ + @Override + public String apiFileFolder() { + return outputFolder + "/" + sourceFolder + "/" + apiPackage().replace('.', File.separatorChar); + } + + @Override + public String getArgumentsLocation() { + return null; + } + + @Override + protected String getTemplateDir() { + return templateDir; + } + + @Override + public String getDefaultTemplateDir() { + return templateDir; + } +} diff --git a/codegen/swagger/src/main/resources/META-INF/services/io.swagger.codegen.v3.CodegenConfig b/codegen/swagger/src/main/resources/META-INF/services/io.swagger.codegen.v3.CodegenConfig new file mode 100644 index 00000000..33505366 --- /dev/null +++ b/codegen/swagger/src/main/resources/META-INF/services/io.swagger.codegen.v3.CodegenConfig @@ -0,0 +1 @@ +com.asana.codegen.PythonClientCodegenGenerator diff --git a/codegen/templates/README.mustache b/codegen/templates/README.mustache new file mode 100644 index 00000000..ddb9e06b --- /dev/null +++ b/codegen/templates/README.mustache @@ -0,0 +1,651 @@ +# {{{projectName}}} [![GitHub release][release-image]]() [![PyPi Version][pypi-image]][pypi-url] + +> **Warning** +> Python client library version `>5.X.X` is currently in BETA and subject to change. Please use v3.2.X for stable / production environments `pip install asana==3.2.2`. If you have feedback on the new version, please your feedback [here](https://form.asana.com/?k=C4sELCq6hAUsoWEY0kJwAA&d=15793206719). + +> You can try out our new python beta by installing version [v{{packageVersion}}](https://github.com/Asana/python-asana/tree/v{{packageVersion}}) (`pip install asana=={{packageVersion}}`) + +- API version: {{appVersion}} +- Package version: {{packageVersion}} +{{^hideGenerationTimestamp}} +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} + +## Requirements. + +Python 3.4+ + +## Installation & Usage +### pip install from [PyPI](https://pypi.org/project/asana/) + +```sh +pip install asana +``` + +Then import the package: +```python +import {{{packageName}}} +``` + +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) + +Then import the package: +```python +import {{{packageName}}} +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```python +{{>code_sample_client}} + +# create an instance of the API class +users_api_instance = {{{packageName}}}.UsersApi(api_client) +user_gid = "me" +opts = {} + +try: + # Get a user + user = users_api_instance.get_user(user_gid, opts) + pprint(user) +except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) +``` + +### Example: GET, POST, PUT, DELETE on tasks + +#### GET - get multiple tasks +```python +{{>code_sample_client}} + +# create an instance of the API class +tasks_api_instance = {{{packageName}}}.TasksApi(api_client) +opts = { + 'limit': 50, + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", + 'assignee': "14641", + 'project': "321654", + 'section': "321654", + 'workspace': "321654", + 'completed_since': '2012-02-22T02:06:58.158Z', + 'modified_since': '2012-02-22T02:06:58.158Z', + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" +} + +try: + # Get multiple tasks + tasks = tasks_api_instance.get_tasks(opts) + for task in tasks: + pprint(task) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +#### POST - create a task +```python +{{>code_sample_client}} + +# create an instance of the API class +tasks_api_instance = {{{packageName}}}.TasksApi(api_client) +body = { + "data": { + "name": "New Task", + "projects": [""], + } +} +opts = {} + +try: + # Create a task + task = tasks_api_instance.create_task(body, opts) + pprint(task) +except ApiException as e: + print("Exception when calling TasksApi->create_task: %s\n" % e) +``` + +#### PUT - update a task +```python +{{>code_sample_client}} + +# create an instance of the API class +tasks_api_instance = {{{packageName}}}.TasksApi(api_client) +body = { + "data": { + "name": "Updated Task", + } +} +task_gid = "" +opts = {} + +try: + # Update a task + task = tasks_api_instance.update_task(body, task_gid, opts) + pprint(task) +except ApiException as e: + print("Exception when calling TasksApi->update_task: %s\n" % e) +``` + +#### DELETE - delete a task +```python +{{>code_sample_client}} + +# create an instance of the API class +tasks_api_instance = {{{packageName}}}.TasksApi(api_client) +task_gid = "" + +try: + # Delete a task + task = tasks_api_instance.delete_task(task_gid) + pprint(task) +except ApiException as e: + print("Exception when calling TasksApi->delete_task: %s\n" % e) +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**](https://github.com/Asana/python-asana/blob/v{{packageVersion}}/{{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Accessing repsonse data + +### Example: Accessing task data +```python +. +. +. +try: + task = tasks_api_instance.get_task(task_gid, opts) + task_name = task['name'] + task_notes = task['notes'] +except ApiException as e: + . + . + . +``` + +## Accessing response status code and headers + +In the scenario you want to access the response headers or the status code along with the response data you can +provide the `_return_http_data_only` parameter argument in the request method and set the value to `False` + +```python +{{>code_sample_client}} + +# create an instance of the API class +users_api_instance = {{{packageName}}}.UsersApi(api_client) +user_gid = 'me' # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +opts = {} + +try: + # Get a user - Add asana-enable in the request + (api_response, status, headers) = users_api_instance.get_user(user_gid, opts, _return_http_data_only=False) # returns a tuple: (response, status, headers) + pprint(api_response) + pprint(status) + pprint(headers) +except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) +``` + +## Adding deprecation flag: "asana-enable" or "asana-disable" header + +### On the client +```python +{{>code_sample_client}} + +# Add asana-enable header for the client +api_client.default_headers['asana-enable'] = 'string_ids' +``` + +OR + +### On the request +```python +{{>code_sample_client}} + +# create an instance of the API class +users_api_instance = {{{packageName}}}.UsersApi(api_client) +user_gid = 'me' # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +opts = {} + +try: + # Get a user - Add asana-enable in the request + api_response = users_api_instance.get_user(user_gid, opts, header_params={'asana-enable': 'string_ids'}) + pprint(api_response) +except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) +``` + +## Async requests with multithreading + +This client library uses multithreading to make async requests. To make async requests you can pass in `async_req=True` in the method call. + +NOTE: +- This feature disables our auto-pagination feature +- You will want to add logic to handle the Asana API rate limits + +The code belows is an example of how to make 15 async create task calls. It does not handle the Asana API rate limits. +You will have to implement your own solution for API rate limits based on your tier. + +```python +{{>code_sample_client}} + +tasks_api_instance = {{{packageName}}}.TasksApi(api_client) +threads = [] +for i in range(1, 15+1): + body = { + "data": { + "name": f"Task: {i}", + "projects": [""] + } + } + opts = {} + threads.append(tasks_api_instance.create_task(body, opts, async_req=True)) + +for thread in threads: + try: + pprint(thread.get()) + except ApiException as e: + print("Exception when calling TasksApi->create_task: %s\n" % e) +``` + +## Pagination + +The pagination feature is enabled by default. This means two things: + +1: Endpoints that return a single response (EX: [get_task](https://github.com/Asana/python-asana/blob/v{{packageVersion}}/{{apiDocPath}}TasksApi.md#get_task) ([Get a task](https://developers.asana.com/reference/gettask)), [get_project](https://github.com/Asana/python-asana/blob/v{{packageVersion}}/{{apiDocPath}}TasksApi.md#get_project) ([Get a project](https://developers.asana.com/reference/getproject)), etc...) +will return a response with the `"data"` key abstracted from the response. + +Instead of returning: +```python +{ + "data": { + "gid": "123", + "actual_time_minutes": null, + "assignee": null, + ... + "workspace": { + "gid": "1234567", + "name": "user@example.com", + "resource_type": "workspace" + } + } +} +``` + +It returns: +```python +{ + "gid": "123", + "actual_time_minutes": null, + "assignee": null, + ... + "workspace": { + "gid": "1234567", + "name": "user@example.com", + "resource_type": "workspace" + } +} +``` + +2: Endpoints that return an array of resources (EX: [get_tasks](https://github.com/Asana/python-asana/blob/v{{packageVersion}}/{{apiDocPath}}TasksApi.md#get_tasks) ([Get multiple tasks](https://developers.asana.com/reference/gettasks)), [get_projects](https://github.com/Asana/python-asana/blob/v{{packageVersion}}/{{apiDocPath}}ProjectsApi.md#get_projects) ([Get multiple projects](https://developers.asana.com/reference/getprojects)), etc...) +will return a generator object ([PageIterator.items](https://github.com/Asana/python-asana/blob/v{{packageVersion}}/{{packageName}}/paget_iterator.py)) that you can use to iterate through each result. + +Example usage 1: +```python +{{>code_sample_client}} + +tasks_api_instance = {{{packageName}}}.TasksApi(api_client) +opts = {"project": ""} + +try: + tasks = tasks_api_instance.get_tasks(opts) + for task in tasks: + pprint(task) + +except Exception as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +Example response: +```python +{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + . + . + . +``` + +Example usage 2: +```python +{{>code_sample_client}} + +tasks_api_instance = {{{packageName}}}.TasksApi(api_client) +opts = {"project": ""} + +try: + tasks = tasks_api_instance.get_tasks(opts) + pprint(list(tasks)) + +except Exception as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +Example response: +```python +[{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + . + . + .] +``` + +### Ending pagination early + +In the scenario where you want to end the pagination early, you can specify an `item_limit` in the method call. This will stop the iterator from going past that limit. + +**Example Scenario:** You have 1000 tasks in a project and are only interested in the first 2 tasks. Instead of letting the pagination code continue to run to get all those 1000 tasks you can specify that you only want the first X results with `item_limit`. + +**Without `item_limit` - The for loop will continue to run until it runs out of tasks:** + +```python + ... + tasks = tasks_api_instance.get_tasks(opts) + for task in tasks: + pprint(task) + ... +``` + +**Sample response:** + +```python +{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + . + . + . + <1000th_TASK> +``` + +**With `item_limit` - the for loop will stop at the `item_limit` you specified:** +```python + ... + tasks = tasks_api_instance.get_tasks(opts, item_limit=2) + for task in tasks: + pprint(task) + ... +``` + +**Sample response:** + +```python +{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, +{'gid': '456', + 'name': 'Task 2', + 'resource_subtype': 'default_task', + 'resource_type': 'task'} +``` + +Alternatively, if you are iterating over the generator object in a for loop, you can also just break out of the loop. + +**EX:** +```python +... +opts = {'project': ""} + +try: + count = 0 + tasks = tasks_api_instance.get_tasks(opts) + for task in tasks: + if count == 2: + break + pprint(task) + count += 1 + ... +``` + +**Sample response:** + +```python +{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + {'gid': '456', + 'name': 'Task 2', + 'resource_subtype': 'default_task', + 'resource_type': 'task'} +``` + +### Disabling default pagination behaviour + +If you do not want to use the default pagination behaviour there are two ways to disbale it. + +1: Per request - Disable pagination behavior for a single request - pass in `full_payload=True` in the method request +```python +{{>code_sample_client}} + +tasks_api_instance = {{{packageName}}}.TasksApi(api_client) +opts = {"project": "", "limit": 2} + +try: + tasks = tasks_api_instance.get_tasks(opts, full_payload=True) + pprint(tasks) +except Exception as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +Sample response: +```python +{'data': [{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + {'gid': '456', + 'name': 'Task 2', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}], + 'next_page': {'offset': 'eyJ0...', + 'path': '/tasks?project=789&limit=2&offset=eyJ0...', + 'uri': 'https://app.asana.com/api/1.0/tasks?project=789&limit=2&offset=eyJ0...'}} +``` + +2: Globally - Disable pagination behavior for all requests - Set `return_page_iterator` to False +```python +... +configuration = {{{packageName}}}.Configuration() +configuration.access_token = '' +configuration.return_page_iterator = False +api_client = {{{packageName}}}.ApiClient(configuration) +... +``` + +## Documentation for Using the `call_api` method + +Use this to make HTTP calls when the endpoint does not exist in the current library version or has bugs + +### Example: GET, POST, PUT, DELETE on tasks + +#### GET - get a task +```python +{{>code_sample_client}} + +try: + # GET - get a task + api_response = api_client.call_api( + "/tasks/{task_gid}", + "GET", + path_params={"task_gid": ""}, + query_params={}, + header_params={"Accept": "application/json; charset=utf-8"}, + body=None, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +#### GET - get multiple tasks -> with opt_fields +```python +{{>code_sample_client}} + +try: + # GET - get multiple tasks + api_response = api_client.call_api( + "/tasks", + "GET", + path_params={}, + query_params={ + "project": "", + "opt_fields": "name,notes,projects", + }, + header_params={"Accept": "application/json; charset=utf-8"}, + body=None, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +#### POST - create a task +```python +{{>code_sample_client}} + +try: + # POST - create a task + api_response = api_client.call_api( + "/tasks", + "POST", + path_params={}, + query_params={}, + header_params={ + "Accept": "application/json; charset=utf-8", + "Content-Type": "application/json; charset=utf-8", + }, + body={ + "data": { + "name": "New Task", + "projects": [""], + } + }, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +#### PUT - update a task +```python +{{>code_sample_client}} + +try: + # PUT - update a task + api_response = api_client.call_api( + "/tasks/{task_gid}", + "PUT", + path_params={"task_gid": ""}, + query_params={}, + header_params={ + "Accept": "application/json; charset=utf-8", + "Content-Type": "application/json; charset=utf-8", + }, + body={ + "data": { + "name": "Updated Task", + } + }, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +#### DELETE - delete a task +```python +{{>code_sample_client}} + +try: + # DELETE - delete a task + api_response = api_client.call_api( + "/tasks/{task_gid}", + "DELETE", + path_params={"task_gid": ""}, + query_params={}, + header_params={"Accept": "application/json; charset=utf-8"}, + body=None, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +[release-image]: https://img.shields.io/github/release/asana/python-asana.svg + +[pypi-image]: https://img.shields.io/pypi/v/asana.svg?style=flat-square +[pypi-url]: https://pypi.python.org/pypi/asana/ diff --git a/codegen/templates/__init__package.mustache b/codegen/templates/__init__package.mustache new file mode 100644 index 00000000..cc7fec51 --- /dev/null +++ b/codegen/templates/__init__package.mustache @@ -0,0 +1,14 @@ +# coding: utf-8 + +# flake8: noqa + +{{>partial_header}} + +from __future__ import absolute_import + +# import apis into sdk package +{{#apiInfo}}{{#apis}}from {{importPath}} import {{classname}} +{{/apis}}{{/apiInfo}} +# import ApiClient +from {{packageName}}.api_client import ApiClient +from {{packageName}}.configuration import Configuration diff --git a/codegen/templates/__init__pagination.mustache b/codegen/templates/__init__pagination.mustache new file mode 100644 index 00000000..22480848 --- /dev/null +++ b/codegen/templates/__init__pagination.mustache @@ -0,0 +1,11 @@ +# coding: utf-8 + +# flake8: noqa + +{{>partial_header}} + +from __future__ import absolute_import + +# import pagination into pagination package +from {{packageName}}.pagination.page_iterator import PageIterator +from {{packageName}}.pagination.event_iterator import EventIterator diff --git a/codegen/templates/api.mustache b/codegen/templates/api.mustache new file mode 100644 index 00000000..fcaa8573 --- /dev/null +++ b/codegen/templates/api.mustache @@ -0,0 +1,306 @@ +# coding: utf-8 + +{{>partial_header}} + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six +from {{packageName}}.api_client import ApiClient +from {{packageName}}.pagination.event_iterator import EventIterator +from {{packageName}}.pagination.page_iterator import PageIterator + +{{#operations}} +class {{classname}}(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client +{{#operation}} +{{#contents}} + + def {{operationId}}(self, {{vendorExtensions.x-codegen-arg-list}}, **kwargs): # noqa: E501 + """{{#summary}}{{{.}}}{{/summary}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 + +{{#notes}} + {{{notes}}} # noqa: E501 +{{/notes}} + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True +{{#sortParamsByRequiredFlag}} + >>> thread = api.{{operationId}}({{#parameters}}{{#required}}{{paramName}}, {{/required}}{{/parameters}}async_req=True) +{{/sortParamsByRequiredFlag}} +{{^sortParamsByRequiredFlag}} + >>> thread = api.{{operationId}}({{#parameters}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/parameters}}async_req=True) +{{/sortParamsByRequiredFlag}} + >>> result = thread.get() + + :param async_req bool +{{#parameters}} + :param {{dataType}} {{paramName}}:{{#description}} {{{description}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}} +{{/parameters}} + :return: {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}} + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.{{operationId}}_with_http_info({{vendorExtensions.x-codegen-arg-list}}, **kwargs) # noqa: E501 + else: + (data) = self.{{operationId}}_with_http_info({{vendorExtensions.x-codegen-arg-list}}, **kwargs) # noqa: E501 + return data + + def {{operationId}}_with_http_info(self, {{vendorExtensions.x-codegen-arg-list}}, **kwargs): # noqa: E501 + """{{#summary}}{{{.}}}{{/summary}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 + +{{#notes}} + {{{notes}}} # noqa: E501 +{{/notes}} + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True +{{#sortParamsByRequiredFlag}} + >>> thread = api.{{operationId}}_with_http_info({{#parameters}}{{#required}}{{paramName}}, {{/required}}{{/parameters}}async_req=True) +{{/sortParamsByRequiredFlag}} +{{^sortParamsByRequiredFlag}} + >>> thread = api.{{operationId}}_with_http_info({{#parameters}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/parameters}}async_req=True) +{{/sortParamsByRequiredFlag}} + >>> result = thread.get() + + :param async_req bool +{{#parameters}} + :param {{dataType}} {{paramName}}:{{#description}} {{{description}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/optional}} +{{/parameters}} + :return: {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}} + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + {{#vendorExtensions.x-codegen-isSearchTasksForWorkspace}} + matchSnakeCase = '^custom_fields_(.*?)_.*$' + custom_fields_query_param_keys = [] + {{/vendorExtensions.x-codegen-isSearchTasksForWorkspace}} + for key, val in six.iteritems(params['kwargs']): + {{#vendorExtensions.x-codegen-isSearchTasksForWorkspace}} + # Do not throw an error if the user provides custom field query parameters + if (re.match(matchSnakeCase, key)): + custom_field_gid = re.search(matchSnakeCase, key).group(1) + custom_field_query_param_key = key.replace(f'custom_fields_{custom_field_gid}_', f'custom_fields.{custom_field_gid}.') + params[custom_field_query_param_key] = val + custom_fields_query_param_keys.append(custom_field_query_param_key) + continue + {{/vendorExtensions.x-codegen-isSearchTasksForWorkspace}} + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method {{operationId}}" % key + ) + params[key] = val + del params['kwargs'] +{{#parameters}} +{{#required}} + # verify the required parameter '{{paramName}}' is set + if ({{paramName}} is None): + raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") # noqa: E501 +{{/required}} +{{/parameters}} + +{{#parameters}} +{{#hasValidation}} + {{#maxLength}} + if ('{{paramName}}' in params and + len(params['{{paramName}}']) > {{maxLength}}): + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be less than or equal to `{{maxLength}}`") # noqa: E501 + {{/maxLength}} + {{#minLength}} + if ('{{paramName}}' in params and + len(params['{{paramName}}']) < {{minLength}}): + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be greater than or equal to `{{minLength}}`") # noqa: E501 + {{/minLength}} + {{#maximum}} + if '{{paramName}}' in params and params['{{paramName}}'] >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}: # noqa: E501 + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`") # noqa: E501 + {{/maximum}} + {{#minimum}} + if '{{paramName}}' in params and params['{{paramName}}'] <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}: # noqa: E501 + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`") # noqa: E501 + {{/minimum}} + {{#pattern}} + if '{{paramName}}' in params and not re.search(r'{{{vendorExtensions.x-regex}}}', params['{{paramName}}']{{#vendorExtensions.x-modifiers}}{{#@first}}, flags={{/@first}}re.{{.}}{{^@last}} | {{/@last}}{{/vendorExtensions.x-modifiers}}): # noqa: E501 + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{{pattern}}}`") # noqa: E501 + {{/pattern}} + {{#maxItems}} + if ('{{paramName}}' in params and + len(params['{{paramName}}']) > {{maxItems}}): + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be less than or equal to `{{maxItems}}`") # noqa: E501 + {{/maxItems}} + {{#minItems}} + if ('{{paramName}}' in params and + len(params['{{paramName}}']) < {{minItems}}): + raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be greater than or equal to `{{minItems}}`") # noqa: E501 + {{/minItems}} +{{/hasValidation}} +{{#@last}} +{{/@last}} +{{/parameters}} + collection_formats = {} + + path_params = {} +{{#pathParams}} + path_params['{{baseName}}'] = {{paramName}}{{#isListContainer}} # noqa: E501 + collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501 +{{/pathParams}} + + query_params = [] + {{#hasOptionalParams}} + query_params = opts + {{/hasOptionalParams}} + {{#queryParams}}{{#required}} + query_params['{{baseName}}'] = {{paramName}} + {{/required}}{{/queryParams}} + +{{#vendorExtensions.x-codegen-isSearchTasksForWorkspace}} + # Checks if the user provided custom field query parameters and adds it to the request + for key in custom_fields_query_param_keys: + query_params[key] = params[key] # noqa: E501 +{{/vendorExtensions.x-codegen-isSearchTasksForWorkspace}} + + header_params = kwargs.get("header_params", {}) +{{#headerParams}} + if '{{paramName}}' in params: + header_params['{{baseName}}'] = params['{{paramName}}']{{#isListContainer}} # noqa: E501 + collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501 +{{/headerParams}} + + form_params = [] + local_var_files = {} +{{#formParams}} + if '{{paramName}}' in opts: + {{^isBinary}}form_params.append(('{{baseName}}', opts['{{paramName}}'])){{/isBinary}}{{#isBinary}}local_var_files['{{baseName}}'] = opts['{{paramName}}']{{/isBinary}}{{#isListContainer}} # noqa: E501 + collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('{{baseName}}') +{{/formParams}} + + body_params = {{#bodyParam}}{{#required}}{{paramName}}{{/required}}{{^required}}opts['{{paramName}}']{{/required}}{{/bodyParam}}{{^bodyParam}}None{{/bodyParam}} + + {{#hasProduces}} + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + [{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}]) # noqa: E501 + + {{/hasProduces}} + {{#hasConsumes}} + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + [{{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}]) # noqa: E501 + + {{/hasConsumes}} + # Authentication setting + auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '{{{path}}}', '{{httpMethod}}', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + {{#vendorExtensions.x-codegen-isArrayResponse}} + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + {{#vendorExtensions.x-codegen-isGetEvents}} + return EventIterator( + {{/vendorExtensions.x-codegen-isGetEvents}} + {{^vendorExtensions.x-codegen-isGetEvents}} + return PageIterator( + {{/vendorExtensions.x-codegen-isGetEvents}} + self.api_client, + { + "resource_path": '{{&path}}', + "method": '{{httpMethod}}', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + {{/vendorExtensions.x-codegen-isArrayResponse}} + {{^vendorExtensions.x-codegen-isArrayResponse}} + (data) = self.api_client.call_api( + '{{{path}}}', '{{httpMethod}}', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + {{/vendorExtensions.x-codegen-isArrayResponse}} + else: + return self.api_client.call_api( + '{{{path}}}', '{{httpMethod}}', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) +{{/contents}} +{{/operation}} +{{/operations}} diff --git a/codegen/templates/api_client.mustache b/codegen/templates/api_client.mustache new file mode 100644 index 00000000..9b287d7e --- /dev/null +++ b/codegen/templates/api_client.mustache @@ -0,0 +1,633 @@ +# coding: utf-8 +{{>partial_header}} +from __future__ import absolute_import + +import logging +import datetime +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import platform +import re +import tempfile + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import quote +{{#tornado}} +import tornado.gen +{{/tornado}} + +from {{packageName}}.configuration import Configuration +from {{packageName}} import rest + +from urllib.parse import urlencode + + +class ApiClient(object): + """Generic API client for Swagger client library builds. + + Swagger 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 + 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 + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + + try: + self.pool = ThreadPool() + except OSError: + logging.warning('Looks like your system does not support ThreadPool but it will try without it if you do not use async requests') + 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 = '{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{packageVersion}}}/python{{/httpUserAgent}}' + # Add custom header + self.default_headers['X-Asana-Client-Lib'] = urlencode( + { + 'language': 'Python', + 'version': '{{{packageVersion}}}', + 'language_version': platform.python_version(), + 'os': platform.system(), + 'os_version': platform.release() + } + ) + + def __del__(self): + if hasattr(self, "pool"): + self.pool.close() + self.pool.join() + + @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 + + {{#tornado}} + @tornado.gen.coroutine + {{/tornado}} + {{#asyncio}}async {{/asyncio}}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): + + 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) + ) + + # 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 = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + url = self.configuration.host + resource_path + + # perform request and return response + response_data = {{#asyncio}}await {{/asyncio}}{{#tornado}}yield {{/tornado}}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 + +{{^tornado}} + if _return_http_data_only: + return (return_data) + else: + return (return_data, response_data.status, + response_data.getheaders()) +{{/tornado}} +{{#tornado}} + if _return_http_data_only: + raise tornado.gen.Return(return_data) + else: + raise tornado.gen.Return((return_data, response_data.status, + response_data.getheaders())) +{{/tornado}} + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + 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 list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is swagger 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, self.PRIMITIVE_TYPES): + return 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() + + if isinstance(obj, dict): + obj_dict = obj + 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): + """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. + + :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: + # Decode the byte string and replace non-breaking space characters with regular + # spaces then parse the json bytes into a python dict + data = json.loads(response.data.decode('utf8').replace('\xa0', ' ')) + except ValueError: + data = response.data + + 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 type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match(r'list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datatime(data) + else: + return data + + 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_req=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_req 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_req 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_req parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async_req is False or missing, + then the method will return the response directly. + """ + + # Convert query params dict into a list of query param tuples. + # This step was previous implemented in the api.mustache but we needed + # to modify the query params dict for pagination so we move this conversion step here + query_params = [(k, v) for k, v in query_params.items()] + + if not async_req: + 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. + + :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 = [] + if collection_formats is None: + collection_formats = {} + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + 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 prepare_post_parameters(self, post_params=None, files=None): + """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])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + 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 '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] + + def update_params_for_auth(self, headers, querys, auth_settings): + """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 auth_settings: Authentication setting identifiers list. + """ + if not auth_settings: + return + + for auth in auth_settings: + # In the OAS we define "personalAccessToken" but for the SDK we want users to use the term "token" + # this logic will get the auth_settings for "token" settings that we've added + if auth == 'personalAccessToken': + auth_setting = self.configuration.auth_settings().get('token') + else: + 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`' + ) + + 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. + + :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.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + response_data = response.data + with open(path, "wb") as f: + if isinstance(response_data, str): + # change str to bytes so we can write it + response_data = response_data.encode('utf-8') + f.write(response_data) + else: + 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 six.text_type(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return a original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + 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_datatime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + 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 __hasattr(self, object, name): + return name in object.__class__.__dict__ diff --git a/codegen/templates/api_doc.mustache b/codegen/templates/api_doc.mustache new file mode 100644 index 00000000..1987dbfd --- /dev/null +++ b/codegen/templates/api_doc.mustache @@ -0,0 +1,49 @@ +# {{packageName}}.{{classname}}{{#description}} +{{description}}{{/description}} + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} +{{#contents}} +{{#@first}} +# **{{{operationId}}}** + +{{summary}}{{#notes}} + +{{{notes}}}{{/notes}} + +([more information](https://developers.asana.com/reference/{{{vendorExtensions.x-codegen-operationIdLowerCase}}})) + +### Example +```python +{{>code_sample}} +``` + +### Parameters +{{^parameters}}This endpoint does not need any parameter.{{/parameters}}{{#parameters}}{{#@last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/@last}}{{/parameters}} +{{#parameters}} **{{paramName}}** | {{#isBinary}}**{{dataType}}**{{/isBinary}}{{^isBinary}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}**Dict**{{/isPrimitiveType}}{{/isBinary}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{/parameters}} + +### Return type + +{{#vendorExtensions.x-codegen-isArrayResponse}}generator{{/vendorExtensions.x-codegen-isArrayResponse}}{{^vendorExtensions.x-codegen-isArrayResponse}}dict{{/vendorExtensions.x-codegen-isArrayResponse}} + +### HTTP request headers + + - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +{{/@first}} +{{/contents}} +{{/operation}} +{{/operations}} diff --git a/codegen/templates/code_sample.mustache b/codegen/templates/code_sample.mustache new file mode 100644 index 00000000..e51a2fc1 --- /dev/null +++ b/codegen/templates/code_sample.mustache @@ -0,0 +1,36 @@ +{{>code_sample_client}}{{#hasAuthMethods}} + +# create an instance of the API class +{{{vendorExtensions.x-codegen-resourceInstanceName}}} = {{{packageName}}}.{{{classname}}}(api_client){{#hasParams}} +{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#parameters}}{{#required}} +{{{paramName}}} = {{{example}}} # {{{dataType}}} | {{{description}}} +{{/required}}{{/parameters}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}} +opts = { {{#parameters}}{{^required}} + '{{{paramName}}}': {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} # {{{dataType}}} | {{{description}}}{{/required}}{{/parameters}} +}{{/hasOptionalParams}}{{/hasParams}} +{{/hasAuthMethods}} +{{^hasAuthMethods}} + +# create an instance of the API class +{{{vendorExtensions.x-codegen-resourceInstanceName}}} = {{{packageName}}}.{{{classname}}}() +{{#parameters}} +{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} +{{/parameters}} +{{/hasAuthMethods}} +{{#vendorExtensions.x-codegen-isSearchTasksForWorkspace}} +opts['custom_fields.123.is_set'] = True # bool | Filiter to tasks with custom field set or unset. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.value'] = '456' # str or bool or Enum option ID | Filter to tasks with custom field that matches the provided value. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.starts_with'] = 'start' # string | Filter to tasks with custom field that starts with provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.ends_with'] = 'end' # string | Filter to tasks with custom field that ends in provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.contains'] = 'first' # string | Filter to tasks with custom field that contains the provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.less_than'] = 10 # number | Filter to tasks with custom field with number value less than the provided number. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.greater_than'] = 100 # number | Filter to tasks with custom field with number value greater than the provided number. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +{{/vendorExtensions.x-codegen-isSearchTasksForWorkspace}} + +try: +{{#summary}} # {{{.}}} +{{/summary}} {{#returnType}}api_response = {{/returnType}}{{{vendorExtensions.x-codegen-resourceInstanceName}}}.{{{operationId}}}({{#vendorExtensions.x-codegen-templateParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/vendorExtensions.x-codegen-templateParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{#returnType}} + {{#vendorExtensions.x-codegen-isArrayResponse}}for data in api_response: + pprint(data){{/vendorExtensions.x-codegen-isArrayResponse}}{{/returnType}}{{^vendorExtensions.x-codegen-isArrayResponse}}pprint(api_response){{/vendorExtensions.x-codegen-isArrayResponse}} +except ApiException as e: + print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) diff --git a/codegen/templates/code_sample_client.mustache b/codegen/templates/code_sample_client.mustache new file mode 100644 index 00000000..51255f04 --- /dev/null +++ b/codegen/templates/code_sample_client.mustache @@ -0,0 +1,20 @@ +import {{{packageName}}} +from {{{packageName}}}.rest import ApiException +from pprint import pprint +{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}} +# Configure HTTP basic authorization: {{{name}}} +configuration = {{{packageName}}}.Configuration() +configuration.username = 'YOUR_USERNAME' +configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}} +# Configure API key authorization: {{{name}}} +configuration = {{{packageName}}}.Configuration() +configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} +# Configure OAuth2 access token for authorization: {{{name}}} +configuration = {{{packageName}}}.Configuration() +configuration.access_token = ''{{/isOAuth}}{{#isBearer}} +configuration = {{{packageName}}}.Configuration() +configuration.access_token = '' +{{/isBearer}}{{/authMethods}} +api_client = {{{packageName}}}.ApiClient(configuration){{/hasAuthMethods}} diff --git a/codegen/templates/code_samples.mustache b/codegen/templates/code_samples.mustache new file mode 100644 index 00000000..63275fda --- /dev/null +++ b/codegen/templates/code_samples.mustache @@ -0,0 +1,11 @@ +{{classname}}: +{{#operations}} +{{#operation}} +{{#contents}} +{{#@first}} + {{operationId}}: |- + {{>code_sample}} +{{/@first}} +{{/contents}} +{{/operation}} +{{/operations}} diff --git a/codegen/templates/configuration.mustache b/codegen/templates/configuration.mustache new file mode 100644 index 00000000..1074e77e --- /dev/null +++ b/codegen/templates/configuration.mustache @@ -0,0 +1,284 @@ +# coding: utf-8 + +{{>partial_header}} + +from __future__ import absolute_import + +import copy +import logging +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) + + +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. + """ + + def __init__(self): + """Constructor""" + # Default Base url + self.host = "{{{basePath}}}" + # Temp file folder for downloading files + self.temp_folder_path = None + + # Authentication Settings + # dict to store API key(s) + self.api_key = {} + # dict to store API prefix (e.g. Bearer) + self.api_key_prefix = {} + # function to refresh API key if expired + self.refresh_api_key_hook = None + # Username for HTTP basic authentication + self.username = "" + # Password for HTTP basic authentication + self.password = "" +{{#authMethods}}{{#isOAuth}} + # access token for OAuth + self.access_token = "" +{{/isOAuth}}{{/authMethods}} + # Logging Settings + self.logger = {} + self.logger["package_logger"] = logging.getLogger("{{packageName}}") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + # Log format + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + # Log stream handler + self.logger_stream_handler = None + # Log file handler + self.logger_file_handler = None + # Debug file location + 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 = '' + + # Collection + # by default we return a collection object to be used for pagination. + # If the user wants to turn this off they can set this to False + self.return_page_iterator = True + + # The default limit query parameter value for api endpoints that return multiple resources + self.page_limit = 100 + + @property + def logger_file(self): + """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): + """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 six.iteritems(self.logger): + 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): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """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 six.iteritems(self.logger): + 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): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """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): + """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): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook: + self.refresh_api_key_hook(self) + + key = self.api_key.get(identifier) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + return urllib3.util.make_headers( + basic_auth=self.username + ':' + self.password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + return { +{{#authMethods}} +{{#isApiKey}} + '{{name}}': + { + 'type': 'api_key', + 'in': {{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{#isKeyInQuery}}'query'{{/isKeyInQuery}}, + 'key': '{{keyParamName}}', + 'value': self.get_api_key_with_prefix('{{keyParamName}}') + }, +{{/isApiKey}} +{{#isBasic}} + '{{name}}': + { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + }, +{{/isBasic}}{{#isOAuth}} + '{{name}}': + { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + }, +{{/isOAuth}}{{#isBearer}} + # Add a case for OAS bearer token definition + 'token': + { + 'type': 'token', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + }, +{{/isBearer}}{{/authMethods}} + } + + def to_debug_report(self): + """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: {{version}}\n"\ + "SDK Package Version: {{packageVersion}}".\ + format(env=sys.platform, pyversion=sys.version) diff --git a/codegen/templates/event_iterator.mustache b/codegen/templates/event_iterator.mustache new file mode 100644 index 00000000..1d5644ae --- /dev/null +++ b/codegen/templates/event_iterator.mustache @@ -0,0 +1,38 @@ +import json +from {{packageName}}.pagination.page_iterator import PageIterator +from {{packageName}}.rest import ApiException + +class EventIterator(PageIterator): + def __init__(self, api_client, api_request_data, **kwargs): + super().__init__(api_client, api_request_data, **kwargs) + self.sync = False + self.has_more = True + + def __next__(self): + if not self.has_more: + raise StopIteration + + result = {} + + try: + result = self.call_api() + except ApiException as e: + if (e.status == 412): + errors = json.loads(e.body.decode("utf-8")) + self.sync = errors["sync"] + else: + raise e + + if (self.sync): + self.api_request_data["query_params"]["sync"] = self.sync + else: + self.sync = result.get('sync', None) + + if not result: + try: + result = self.call_api() + except ApiException as e: + raise e + + self.has_more = result.get('has_more', False) + return result["data"] diff --git a/codegen/templates/gitignore.mustache b/codegen/templates/gitignore.mustache new file mode 100644 index 00000000..447b9425 --- /dev/null +++ b/codegen/templates/gitignore.mustache @@ -0,0 +1,67 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.python-version + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints + +.travis.yml +git_push.sh diff --git a/codegen/templates/page_iterator.mustache b/codegen/templates/page_iterator.mustache new file mode 100644 index 00000000..6f09dbcc --- /dev/null +++ b/codegen/templates/page_iterator.mustache @@ -0,0 +1,64 @@ +from {{packageName}}.rest import ApiException + +class PageIterator(object): + def __init__(self, api_client, api_request_data, **kwargs): + self.__api_client = api_client + self.api_request_data = api_request_data + self.next_page = False + self.item_limit = float('inf') if kwargs.get('item_limit', None) == None else kwargs.get('item_limit') + self.count = 0 + + def __iter__(self): + """Iterator interface, self is an iterator""" + return self + + def __next__(self): + limit = self.api_request_data["query_params"].get("limit", None) + if limit: + self.api_request_data["query_params"]["limit"] = min(limit, self.item_limit - self.count) + + if self.next_page is None or self.api_request_data["query_params"].get("limit", None) == 0: + raise StopIteration + + try: + result = self.call_api() + except ApiException as e: + raise e + + # If the response has a next_page add the offset to the api_request_data for the next request + self.next_page = result.get('next_page', None) + if (self.next_page): + self.api_request_data["query_params"]["offset"] = self.next_page["offset"] + data = result['data'] + if data != None: + self.count += len(data) + return data + + def next(self): + """Alias for __next__""" + return self.__next__() + + def items(self): + """Returns an iterator for each item in each page""" + for page in self: + for item in page: + yield item + + def call_api(self): + return self.__api_client.call_api( + self.api_request_data["resource_path"], + self.api_request_data["method"], + self.api_request_data["path_params"], + self.api_request_data["query_params"], + self.api_request_data["header_params"], + self.api_request_data["body"], + self.api_request_data["post_params"], + self.api_request_data["files"], + self.api_request_data["response_type"], + self.api_request_data["auth_settings"], + self.api_request_data["async_req"], + self.api_request_data["_return_http_data_only"], + self.api_request_data["collection_formats"], + self.api_request_data["_preload_content"], + self.api_request_data["_request_timeout"] + ) diff --git a/codegen/templates/setup.mustache b/codegen/templates/setup.mustache new file mode 100644 index 00000000..0e52d6e1 --- /dev/null +++ b/codegen/templates/setup.mustache @@ -0,0 +1,52 @@ +# coding: utf-8 + +{{>partial_header}} + +import os +from setuptools import setup, find_packages # noqa: H301 + +NAME = "{{{projectName}}}" +VERSION = "{{packageVersion}}" +with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: + LONG_DESCRIPTION = readme.read() +{{#apiInfo}} +{{#apis}} +{{^hasMore}} +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = [ + "certifi>=2017.4.17", + "python-dateutil>=2.1", + "six>=1.10", + "urllib3>=1.23" +] + +{{#asyncio}} +REQUIRES.append("aiohttp") +{{/asyncio}} +{{#tornado}} +REQUIRES.append("tornado") +{{/tornado}} + +setup( + name=NAME, + version=VERSION, + description="{{appName}}", + long_description=LONG_DESCRIPTION, + long_description_content_type='text/markdown', + author='Asana, Inc', + url="http://github.com/asana/python-asana", + keywords=["asana", "{{appName}}"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + license='MIT', +) +{{/hasMore}} +{{/apis}} +{{/apiInfo}} diff --git a/deploy.py b/deploy.py deleted file mode 100755 index a1bd496a..00000000 --- a/deploy.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python - -""" -Script for deploying a new version of the python-asana library. -""" - -from __future__ import print_function - -import argparse -import subprocess - -if __name__ == '__main__': - # Setup parser for command line arguments - parser = argparse.ArgumentParser() - parser.add_argument( - 'part', - choices=['major', 'minor', 'patch'], - help='The part of the version to be bumped' - ) - args = parser.parse_args() - - # Get the current version from asana/version.py - current_version = {} - with open('asana/version.py') as fp: - exec(fp.read(), current_version) - major, minor, patch = current_version['__version__'].split('.') - - # Bump version part based on argument provided - if args.part == 'major': - major = str(int(major) + 1) - minor = 0 - patch = 0 - if args.part == 'minor': - minor = str(int(minor) + 1) - patch = 0 - if args.part == 'patch': - patch = str(int(patch) + 1) - - # Overwrite the version in VERSION and asana/version.py - updated_version = "{}.{}.{}".format(major, minor, patch) - with open('VERSION', 'w') as version_file: - version_file.write("{}".format(updated_version)) - with open('asana/version.py', 'w') as version_file: - version_file.write("__version__ = '{}'\n".format(updated_version)) - - # Add, commit and push version changes to GitHub and tag release - subprocess.call('git add VERSION asana/version.py', shell=True) - subprocess.call( - 'git commit -m "Releasing version {}"'.format(updated_version), shell=True - ) - subprocess.call('git tag v{}'.format(updated_version), shell=True) - subprocess.call('git push --tags origin master:master', shell=True) - - print('Successfully deployed version {}'.format(updated_version)) diff --git a/examples/example-create-task.py b/examples/example-create-task.py deleted file mode 100644 index 29312344..00000000 --- a/examples/example-create-task.py +++ /dev/null @@ -1,46 +0,0 @@ -import sys -import os -import json - -sys.path.append(os.path.dirname(os.path.dirname(__file__))) - -import asana - -# Instructions -# -# 1. Set your ASANA_ACCESS_TOKEN environment variable to a Personal Access Token obtained in your Asana Account Settings -# -# This simple script asks the user to choose from their available Workspaces and then the first page (if more than a -# single page exists) of available projects in order to create a task in that project. -# - -def user_select_option(message, options): - option_lst = list(options) - print_(message) - for i, val in enumerate(option_lst): - print_(i, ': ' + val['name']) - index = int(input("Enter choice (default 0): ") or 0) - return option_lst[index] - - -if 'ASANA_ACCESS_TOKEN' in os.environ: - # create a client with a Personal Access Token - client = asana.Client.access_token(os.environ['ASANA_ACCESS_TOKEN']) - workspaces = client.workspaces.get_workspaces() - - workspace = user_select_option("Please choose a workspace", workspaces) - - projects = client.projects.get_projects({'workspace': workspace['gid']}) - - project = user_select_option("Please choose a project", projects) - - result = client.tasks.create_task( - workspace['gid'], - { - 'name': 'Learn to use Nunchucks', - 'notes': 'Note: This is a test task created with the python-asana client.', - 'projects': [project['gid']] - } - ) - - print(json.dumps(result, indent=4)) diff --git a/examples/example-script.py b/examples/example-script.py deleted file mode 100644 index 72e23e45..00000000 --- a/examples/example-script.py +++ /dev/null @@ -1,85 +0,0 @@ -import sys, os -sys.path.append(os.path.dirname(os.path.dirname(__file__))) - -import asana -import json - -# OAuth Instructions: -# -# 1. create a new application in your Asana Account Settings ("App" panel) -# 2. set the redirect URL to "urn:ietf:wg:oauth:2.0:oob" -# 3. set your ASANA_CLIENT_ID and ASANA_CLIENT_SECRET environment variables -# -# Personal Access Token Instructions: -# -# 1. set your ASANA_ACCESS_TOKEN environment variable to a Personal Access Token obtained in your Asana Account Settings -# - -if 'ASANA_CLIENT_ID' in os.environ: - # create a client with the OAuth credentials: - client = asana.Client.oauth( - client_id=os.environ['ASANA_CLIENT_ID'], - client_secret=os.environ['ASANA_CLIENT_SECRET'], - # this special redirect URI will prompt the user to copy/paste the code. - # useful for command line scripts and other non-web apps - redirect_uri='urn:ietf:wg:oauth:2.0:oob' - ) - print("authorized=", client.session.authorized) - - # get an authorization URL: - (url, state) = client.session.authorization_url() - try: - # in a web app you'd redirect the user to this URL when they take action to - # login with Asana or connect their account to Asana - import webbrowser - webbrowser.open(url) - except Exception as e: - print("Open the following URL in a browser to authorize:") - print(url) - - print("Copy and paste the returned code from the browser and press enter:") - - code = sys.stdin.readline().strip() - # exchange the code for a bearer token - token = client.session.fetch_token(code=code) - - print("token=", json.dumps(token)) - print("authorized=", client.session.authorized) - print("me=", client.users.get_user('me')) - - # normally you'd persist this token somewhere - os.environ['ASANA_TOKEN'] = json.dumps(token) # (see below) - -if 'ASANA_TOKEN' in os.environ: - # create a client with your OAuth client ID and a previously obtained bearer token - client = asana.Client.oauth( - client_id=os.environ['ASANA_CLIENT_ID'], - token=json.loads(os.environ['ASANA_TOKEN']) - ) - print("authorized=", client.session.authorized) - print("me=", client.users.get_user('me')) - -if 'ASANA_ACCESS_TOKEN' in os.environ: - # create a client with a Personal Access Token - client = asana.Client.access_token(os.environ['ASANA_ACCESS_TOKEN']) - me = client.users.get_user('me') - print("me=" + json.dumps(me, indent=2)) - - # find your "Personal Projects" workspace - personal_projects = next(workspace for workspace in me['workspaces'] if workspace['name'] == 'Personal Projects') - projects = client.projects.get_projects(personal_projects['id'], iterator_type=None) - print("personal projects=" + json.dumps(projects, indent=2)) - - # create a "demo project" if it doesn't exist - try: - project = next(project for project in projects if project['name'] == 'demo project') - except: - print("creating 'demo project'") - project = client.projects.create_in_workspace(personal_projects['id'], { 'name': 'demo project' }) - print("project=", project) - - # start streaming modifications to the demo project. - # make some changes in Asana to see this working - print("starting streaming events for " + project['name']) - for event in client.events.get_iterator({ 'resource': project['id'] }): - print("event", event) diff --git a/examples/example-server.py b/examples/example-server.py deleted file mode 100644 index b9ce8385..00000000 --- a/examples/example-server.py +++ /dev/null @@ -1,77 +0,0 @@ -import sys, os -sys.path.append(os.path.dirname(os.path.dirname(__file__))) - -from flask import Flask, request, session, redirect, render_template_string -import asana -import json - -# OAuth Instructions: -# -# 1. create a new application in your Asana Account Settings ("App" panel) -# 2. set the redirect URL to "http://localhost:5000/auth/asana/callback" (or whichever port you choose) -# 3. set your ASANA_CLIENT_ID and ASANA_CLIENT_SECRET environment variables - -# convience method to create a client with your credentials, and optionally a 'token' -def Client(**kwargs): - return asana.Client.oauth( - client_id=os.environ['ASANA_CLIENT_ID'], - client_secret=os.environ['ASANA_CLIENT_SECRET'], - redirect_uri='http://localhost:5000/auth/asana/callback', - **kwargs - ) - -app = Flask(__name__) - -# main page (http://localhost:5000/) -@app.route("/") -def main(): - token = session.get('token', False) - # if the user has a token they're logged in - if token: - # example request gets information about logged in user - me = Client(token=token).users.get_user('me') - return render_template_string(''' - -

Hello {{ name }}.

-

{{ dump }}

-

Logout

''', - name=me['name'], - dump=json.dumps(me, indent=2) - ) - # if we don't have a token show a "Sign in with Asana" button - else: - # get an authorization URL and anti-forgery "state" token - (auth_url, state) = Client().session.authorization_url() - # persist the state token in the user's session - session['state'] = state - # link the button to the authorization URL - return render_template_string(''' -

''', - auth_url=auth_url - ) - -# logout endpoint -@app.route("/logout") -def logout(): - # delete the session token and redirect back to the main page - del session['token'] - return redirect('/') - -# OAuth callback endpoint -@app.route("/auth/asana/callback") -def auth_callback(): - # verify the state token matches to prevent CSRF attacks - if request.args.get('state') == session['state']: - del session['state'] - # exchange the code for a bearer token and persist it in the user's session or database - session['token'] = Client().session.fetch_token(code=request.args.get('code')) - return redirect('/') - else: - return "state doesn't match!" - -app.secret_key = 'set this to something secret' - -if __name__ == "__main__": - app.run(debug=True) diff --git a/examples/example-summary-task.py b/examples/example-summary-task.py deleted file mode 100755 index 66cb860e..00000000 --- a/examples/example-summary-task.py +++ /dev/null @@ -1,106 +0,0 @@ -import asana -import json -from datetime import date -import argparse -import sys, os -sys.path.append(os.path.dirname(os.path.dirname(__file__))) - -def summarize(client, project_id, post_project): - """ - Collect data from project_id, and create a summary task in the post_project. - """ - # Get info on the project - project = client.projects.get_project(project_id) - - # Loop through the tasks, collecting data - all_tasks = 0 - tasks_completed = 0 - tasks = client.tasks.get_tasks_for_project(project_id, opt_fields=['completed']) - for task in tasks: - all_tasks += 1 - if task['completed']: - tasks_completed += 1 - - # Make the summary task - summary_task_fields = { - 'projects': [post_project], - 'name': "{} Summary of \"{}\"".format( - date.today().isoformat(), project['name']), - 'notes': "{} tasks\n{} ({:.0%}) tasks completed".format( - all_tasks, tasks_completed, tasks_completed / all_tasks) - } - client.tasks.create_task(**summary_task_fields) - -def main(): - """ - Parse arguments, authorize user, and summarize each given project. - """ - parser = argparse.ArgumentParser() - parser.add_argument("project_to_summarize", - help="project id of project to summarize") - parser.add_argument("summary_project", - help="project id of summary project to post to") - args = parser.parse_args() - - # Use OAuth - # check if the user has an existing token stored. - authorized = False - client = None - if 'ASANA_CLIENT_ID' in os.environ and 'ASANA_TOKEN' in os.environ: - # create a client with your OAuth client ID and a previously obtained - # bearer token - client = asana.Client.oauth( - client_id=os.environ['ASANA_CLIENT_ID'], - token=json.loads(os.environ['ASANA_TOKEN']) - ) - print("authorized=", client.session.authorized) - - # try to get something to see if token has not expired. - try: - client.users.get_user('me') - authorized = True - except: - print("token expired. please update ASANA_TOKEN") - - # check if the user has the secret - if not authorized and 'ASANA_CLIENT_ID' in os.environ and 'ASANA_CLIENT_SECRET' in os.environ: - # create a client with the OAuth credentials: - client = asana.Client.oauth( - client_id=os.environ['ASANA_CLIENT_ID'], - client_secret=os.environ['ASANA_CLIENT_SECRET'], - # this special redirect URI will prompt the user to copy/paste the code - # useful for command line scripts and other non-web apps - redirect_uri='urn:ietf:wg:oauth:2.0:oob' - ) - - # get an authorization URL: - (url, state) = client.session.authorization_url() - try: - # in a web app you'd redirect the user to this URL when they take - # action to login with Asana or connect their account to Asana - import webbrowser - webbrowser.open(url) - except Exception as e: - print("Open the following URL in a browser to authorize:") - print(url) - - print("Copy and paste the returned code from the browser and press enter:") - - code = sys.stdin.readline().strip() - # exchange the code for a bearer token will fail on incorrect code - token = client.session.fetch_token(code=code) - - print("token=", json.dumps(token)) - - # normally you'd persist this token somewhere - os.environ['ASANA_TOKEN'] = json.dumps(token) # (see below) - - if not client or not client.session.authorized: - print("COULD NOT AUTHORIZE") - exit(1) - - # Summarize the project. - summarize(client, args.project_to_summarize, args.summary_project) - -if __name__ == '__main__': - main() diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index fd138620..00000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -pytest~=7.2 -requests_oauthlib~=1.3 -requests~=2.28 -responses~=0.22 diff --git a/samples/attachments_sample.yaml b/samples/attachments_sample.yaml deleted file mode 100644 index 06d430e2..00000000 --- a/samples/attachments_sample.yaml +++ /dev/null @@ -1,33 +0,0 @@ -attachments: - create_attachment_for_object: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.attachments.create_attachment_for_object({'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_attachment: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.attachments.delete_attachment(attachment_gid, opt_pretty=True) - get_attachment: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.attachments.get_attachment(attachment_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_attachments_for_object: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.attachments.get_attachments_for_object({'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/audit_log_api_sample.yaml b/samples/audit_log_api_sample.yaml deleted file mode 100644 index 8dbcccf5..00000000 --- a/samples/audit_log_api_sample.yaml +++ /dev/null @@ -1,9 +0,0 @@ -auditlogapi: - get_audit_log_events: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.audit_log_api.get_audit_log_events(workspace_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/batch_api_sample.yaml b/samples/batch_api_sample.yaml deleted file mode 100644 index a4a1b1b3..00000000 --- a/samples/batch_api_sample.yaml +++ /dev/null @@ -1,9 +0,0 @@ -batchapi: - create_batch_request: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.batch_api.create_batch_request({'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/custom_field_settings_sample.yaml b/samples/custom_field_settings_sample.yaml deleted file mode 100644 index ded3bf82..00000000 --- a/samples/custom_field_settings_sample.yaml +++ /dev/null @@ -1,17 +0,0 @@ -customfieldsettings: - get_custom_field_settings_for_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.custom_field_settings.get_custom_field_settings_for_portfolio(portfolio_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_custom_field_settings_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.custom_field_settings.get_custom_field_settings_for_project(project_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/custom_fields_sample.yaml b/samples/custom_fields_sample.yaml deleted file mode 100644 index e3b48a1b..00000000 --- a/samples/custom_fields_sample.yaml +++ /dev/null @@ -1,65 +0,0 @@ -customfields: - create_custom_field: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.custom_fields.create_custom_field({'field': 'value', 'field': 'value'}, opt_pretty=True) - create_enum_option_for_custom_field: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.custom_fields.create_enum_option_for_custom_field(custom_field_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_custom_field: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.custom_fields.delete_custom_field(custom_field_gid, opt_pretty=True) - get_custom_field: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.custom_fields.get_custom_field(custom_field_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_custom_fields_for_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.custom_fields.get_custom_fields_for_workspace(workspace_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - insert_enum_option_for_custom_field: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.custom_fields.insert_enum_option_for_custom_field(custom_field_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - update_custom_field: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.custom_fields.update_custom_field(custom_field_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - update_enum_option: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.custom_fields.update_enum_option(enum_option_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/events_sample.yaml b/samples/events_sample.yaml deleted file mode 100644 index 951bede8..00000000 --- a/samples/events_sample.yaml +++ /dev/null @@ -1,9 +0,0 @@ -events: - get_events: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.events.get_events({'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/goal_relationships_sample.yaml b/samples/goal_relationships_sample.yaml deleted file mode 100644 index 74384947..00000000 --- a/samples/goal_relationships_sample.yaml +++ /dev/null @@ -1,41 +0,0 @@ -goalrelationships: - add_supporting_relationship: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goal_relationships.add_supporting_relationship(goal_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - get_goal_relationship: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goal_relationships.get_goal_relationship(goal_relationship_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_goal_relationships: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goal_relationships.get_goal_relationships({'param': 'value', 'param': 'value'}, opt_pretty=True) - remove_supporting_relationship: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goal_relationships.remove_supporting_relationship(goal_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - update_goal_relationship: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goal_relationships.update_goal_relationship(goal_relationship_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/goals_sample.yaml b/samples/goals_sample.yaml deleted file mode 100644 index 100819cc..00000000 --- a/samples/goals_sample.yaml +++ /dev/null @@ -1,81 +0,0 @@ -goals: - add_followers: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goals.add_followers(goal_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - create_goal: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goals.create_goal({'field': 'value', 'field': 'value'}, opt_pretty=True) - create_goal_metric: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goals.create_goal_metric(goal_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_goal: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goals.delete_goal(goal_gid, opt_pretty=True) - get_goal: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goals.get_goal(goal_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_goals: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goals.get_goals({'param': 'value', 'param': 'value'}, opt_pretty=True) - get_parent_goals_for_goal: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goals.get_parent_goals_for_goal(goal_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - remove_followers: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goals.remove_followers(goal_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - update_goal: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goals.update_goal(goal_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - update_goal_metric: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.goals.update_goal_metric(goal_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/jobs_sample.yaml b/samples/jobs_sample.yaml deleted file mode 100644 index 1d97b5ea..00000000 --- a/samples/jobs_sample.yaml +++ /dev/null @@ -1,9 +0,0 @@ -jobs: - get_job: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.jobs.get_job(job_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/memberships_sample.yaml b/samples/memberships_sample.yaml deleted file mode 100644 index c60224b7..00000000 --- a/samples/memberships_sample.yaml +++ /dev/null @@ -1,33 +0,0 @@ -memberships: - create_membership: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.memberships.create_membership({'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_membership: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.memberships.delete_membership(membership_gid, opt_pretty=True) - get_memberships: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.memberships.get_memberships({'param': 'value', 'param': 'value'}, opt_pretty=True) - update_membership: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.memberships.update_membership(membership_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/message_sample.yaml b/samples/message_sample.yaml deleted file mode 100644 index 89e5df77..00000000 --- a/samples/message_sample.yaml +++ /dev/null @@ -1,9 +0,0 @@ -message: - get_message: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.message.get_message(message_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/organization_exports_sample.yaml b/samples/organization_exports_sample.yaml deleted file mode 100644 index 1e1414c6..00000000 --- a/samples/organization_exports_sample.yaml +++ /dev/null @@ -1,17 +0,0 @@ -organizationexports: - create_organization_export: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.organization_exports.create_organization_export({'field': 'value', 'field': 'value'}, opt_pretty=True) - get_organization_export: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.organization_exports.get_organization_export(organization_export_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/portfolio_memberships_sample.yaml b/samples/portfolio_memberships_sample.yaml deleted file mode 100644 index ca32a779..00000000 --- a/samples/portfolio_memberships_sample.yaml +++ /dev/null @@ -1,25 +0,0 @@ -portfoliomemberships: - get_portfolio_membership: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolio_memberships.get_portfolio_membership(portfolio_membership_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_portfolio_memberships: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolio_memberships.get_portfolio_memberships({'param': 'value', 'param': 'value'}, opt_pretty=True) - get_portfolio_memberships_for_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolio_memberships.get_portfolio_memberships_for_portfolio(portfolio_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/portfolios_sample.yaml b/samples/portfolios_sample.yaml deleted file mode 100644 index 4bbc0f6a..00000000 --- a/samples/portfolios_sample.yaml +++ /dev/null @@ -1,97 +0,0 @@ -portfolios: - add_custom_field_setting_for_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolios.add_custom_field_setting_for_portfolio(portfolio_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - add_item_for_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolios.add_item_for_portfolio(portfolio_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - add_members_for_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolios.add_members_for_portfolio(portfolio_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - create_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolios.create_portfolio({'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolios.delete_portfolio(portfolio_gid, opt_pretty=True) - get_items_for_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolios.get_items_for_portfolio(portfolio_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolios.get_portfolio(portfolio_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_portfolios: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolios.get_portfolios({'param': 'value', 'param': 'value'}, opt_pretty=True) - remove_custom_field_setting_for_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolios.remove_custom_field_setting_for_portfolio(portfolio_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - remove_item_for_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolios.remove_item_for_portfolio(portfolio_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - remove_members_for_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolios.remove_members_for_portfolio(portfolio_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - update_portfolio: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.portfolios.update_portfolio(portfolio_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/project_briefs_sample.yaml b/samples/project_briefs_sample.yaml deleted file mode 100644 index af64d5a7..00000000 --- a/samples/project_briefs_sample.yaml +++ /dev/null @@ -1,33 +0,0 @@ -projectbriefs: - create_project_brief: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_briefs.create_project_brief(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_project_brief: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_briefs.delete_project_brief(project_brief_gid, opt_pretty=True) - get_project_brief: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_briefs.get_project_brief(project_brief_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - update_project_brief: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_briefs.update_project_brief(project_brief_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/project_memberships_sample.yaml b/samples/project_memberships_sample.yaml deleted file mode 100644 index 32539a28..00000000 --- a/samples/project_memberships_sample.yaml +++ /dev/null @@ -1,17 +0,0 @@ -projectmemberships: - get_project_membership: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_memberships.get_project_membership(project_membership_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_project_memberships_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_memberships.get_project_memberships_for_project(project_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/project_statuses_sample.yaml b/samples/project_statuses_sample.yaml deleted file mode 100644 index 4b9703d6..00000000 --- a/samples/project_statuses_sample.yaml +++ /dev/null @@ -1,33 +0,0 @@ -projectstatuses: - create_project_status_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_statuses.create_project_status_for_project(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_project_status: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_statuses.delete_project_status(project_status_gid, opt_pretty=True) - get_project_status: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_statuses.get_project_status(project_status_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_project_statuses_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_statuses.get_project_statuses_for_project(project_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/project_templates_sample.yaml b/samples/project_templates_sample.yaml deleted file mode 100644 index ae4b37d5..00000000 --- a/samples/project_templates_sample.yaml +++ /dev/null @@ -1,33 +0,0 @@ -projecttemplates: - get_project_template: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_templates.get_project_template(project_template_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_project_templates: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_templates.get_project_templates({'param': 'value', 'param': 'value'}, opt_pretty=True) - get_project_templates_for_team: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_templates.get_project_templates_for_team(team_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - instantiate_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.project_templates.instantiate_project(project_template_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/projects_sample.yaml b/samples/projects_sample.yaml deleted file mode 100644 index 30fd7d09..00000000 --- a/samples/projects_sample.yaml +++ /dev/null @@ -1,153 +0,0 @@ -projects: - add_custom_field_setting_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.add_custom_field_setting_for_project(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - add_followers_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.add_followers_for_project(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - add_members_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.add_members_for_project(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - create_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.create_project({'field': 'value', 'field': 'value'}, opt_pretty=True) - create_project_for_team: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.create_project_for_team(team_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - create_project_for_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.create_project_for_workspace(workspace_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.delete_project(project_gid, opt_pretty=True) - duplicate_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.duplicate_project(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - get_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.get_project(project_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_projects: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.get_projects({'param': 'value', 'param': 'value'}, opt_pretty=True) - get_projects_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.get_projects_for_task(task_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_projects_for_team: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.get_projects_for_team(team_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_projects_for_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.get_projects_for_workspace(workspace_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_task_counts_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.get_task_counts_for_project(project_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - project_save_as_template: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.project_save_as_template(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - remove_custom_field_setting_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.remove_custom_field_setting_for_project(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - remove_followers_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.remove_followers_for_project(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - remove_members_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.remove_members_for_project(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - update_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.projects.update_project(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/sections_sample.yaml b/samples/sections_sample.yaml deleted file mode 100644 index c6e7eeca..00000000 --- a/samples/sections_sample.yaml +++ /dev/null @@ -1,57 +0,0 @@ -sections: - add_task_for_section: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.sections.add_task_for_section(section_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - create_section_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.sections.create_section_for_project(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_section: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.sections.delete_section(section_gid, opt_pretty=True) - get_section: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.sections.get_section(section_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_sections_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.sections.get_sections_for_project(project_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - insert_section_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.sections.insert_section_for_project(project_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - update_section: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.sections.update_section(section_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/status_updates_sample.yaml b/samples/status_updates_sample.yaml deleted file mode 100644 index 9da2ba90..00000000 --- a/samples/status_updates_sample.yaml +++ /dev/null @@ -1,33 +0,0 @@ -statusupdates: - create_status_for_object: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.status_updates.create_status_for_object({'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_status: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.status_updates.delete_status(status_gid, opt_pretty=True) - get_status: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.status_updates.get_status(status_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_statuses_for_object: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.status_updates.get_statuses_for_object({'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/stories_sample.yaml b/samples/stories_sample.yaml deleted file mode 100644 index c6d858fb..00000000 --- a/samples/stories_sample.yaml +++ /dev/null @@ -1,41 +0,0 @@ -stories: - create_story_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.stories.create_story_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_story: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.stories.delete_story(story_gid, opt_pretty=True) - get_stories_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.stories.get_stories_for_task(task_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_story: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.stories.get_story(story_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - update_story: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.stories.update_story(story_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/tags_sample.yaml b/samples/tags_sample.yaml deleted file mode 100644 index fdf954cb..00000000 --- a/samples/tags_sample.yaml +++ /dev/null @@ -1,65 +0,0 @@ -tags: - create_tag: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tags.create_tag({'field': 'value', 'field': 'value'}, opt_pretty=True) - create_tag_for_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tags.create_tag_for_workspace(workspace_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_tag: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tags.delete_tag(tag_gid, opt_pretty=True) - get_tag: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tags.get_tag(tag_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_tags: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tags.get_tags({'param': 'value', 'param': 'value'}, opt_pretty=True) - get_tags_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tags.get_tags_for_task(task_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_tags_for_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tags.get_tags_for_workspace(workspace_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - update_tag: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tags.update_tag(tag_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/tasks_sample.yaml b/samples/tasks_sample.yaml deleted file mode 100644 index b551a3dc..00000000 --- a/samples/tasks_sample.yaml +++ /dev/null @@ -1,209 +0,0 @@ -tasks: - add_dependencies_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.add_dependencies_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - add_dependents_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.add_dependents_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - add_followers_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.add_followers_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - add_project_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.add_project_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - add_tag_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.add_tag_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - create_subtask_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.create_subtask_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - create_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.create_task({'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.delete_task(task_gid, opt_pretty=True) - duplicate_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.duplicate_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - get_dependencies_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.get_dependencies_for_task(task_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_dependents_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.get_dependents_for_task(task_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_subtasks_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.get_subtasks_for_task(task_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.get_task(task_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_tasks: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.get_tasks({'param': 'value', 'param': 'value'}, opt_pretty=True) - get_tasks_for_project: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.get_tasks_for_project(project_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_tasks_for_section: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.get_tasks_for_section(section_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_tasks_for_tag: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.get_tasks_for_tag(tag_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_tasks_for_user_task_list: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.get_tasks_for_user_task_list(user_task_list_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - remove_dependencies_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.remove_dependencies_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - remove_dependents_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.remove_dependents_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - remove_follower_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.remove_follower_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - remove_project_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.remove_project_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - remove_tag_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.remove_tag_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - search_tasks_for_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.search_tasks_for_workspace(workspace_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - set_parent_for_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.set_parent_for_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - update_task: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.tasks.update_task(task_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/team_memberships_sample.yaml b/samples/team_memberships_sample.yaml deleted file mode 100644 index 2b30cfb1..00000000 --- a/samples/team_memberships_sample.yaml +++ /dev/null @@ -1,33 +0,0 @@ -teammemberships: - get_team_membership: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.team_memberships.get_team_membership(team_membership_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_team_memberships: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.team_memberships.get_team_memberships({'param': 'value', 'param': 'value'}, opt_pretty=True) - get_team_memberships_for_team: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.team_memberships.get_team_memberships_for_team(team_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_team_memberships_for_user: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.team_memberships.get_team_memberships_for_user(user_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/teams_sample.yaml b/samples/teams_sample.yaml deleted file mode 100644 index d2e09aca..00000000 --- a/samples/teams_sample.yaml +++ /dev/null @@ -1,57 +0,0 @@ -teams: - add_user_for_team: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.teams.add_user_for_team(team_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - create_team: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.teams.create_team({'field': 'value', 'field': 'value'}, opt_pretty=True) - get_team: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.teams.get_team(team_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_teams_for_user: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.teams.get_teams_for_user(user_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_teams_for_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.teams.get_teams_for_workspace(workspace_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - remove_user_for_team: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.teams.remove_user_for_team(team_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - update_team: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.teams.update_team({'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/time_periods_sample.yaml b/samples/time_periods_sample.yaml deleted file mode 100644 index e9c7e415..00000000 --- a/samples/time_periods_sample.yaml +++ /dev/null @@ -1,17 +0,0 @@ -timeperiods: - get_time_period: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.time_periods.get_time_period(time_period_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_time_periods: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.time_periods.get_time_periods({'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/typeahead_sample.yaml b/samples/typeahead_sample.yaml deleted file mode 100644 index 37b55e19..00000000 --- a/samples/typeahead_sample.yaml +++ /dev/null @@ -1,9 +0,0 @@ -typeahead: - typeahead_for_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.typeahead.typeahead_for_workspace(workspace_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/user_task_lists_sample.yaml b/samples/user_task_lists_sample.yaml deleted file mode 100644 index 8c73f216..00000000 --- a/samples/user_task_lists_sample.yaml +++ /dev/null @@ -1,17 +0,0 @@ -usertasklists: - get_user_task_list: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.user_task_lists.get_user_task_list(user_task_list_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_user_task_list_for_user: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.user_task_lists.get_user_task_list_for_user(user_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/users_sample.yaml b/samples/users_sample.yaml deleted file mode 100644 index dfbae326..00000000 --- a/samples/users_sample.yaml +++ /dev/null @@ -1,41 +0,0 @@ -users: - get_favorites_for_user: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.users.get_favorites_for_user(user_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_user: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.users.get_user(user_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_users: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.users.get_users({'param': 'value', 'param': 'value'}, opt_pretty=True) - get_users_for_team: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.users.get_users_for_team(team_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_users_for_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.users.get_users_for_workspace(workspace_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/webhooks_sample.yaml b/samples/webhooks_sample.yaml deleted file mode 100644 index 7cd66242..00000000 --- a/samples/webhooks_sample.yaml +++ /dev/null @@ -1,41 +0,0 @@ -webhooks: - create_webhook: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.webhooks.create_webhook({'field': 'value', 'field': 'value'}, opt_pretty=True) - delete_webhook: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.webhooks.delete_webhook(webhook_gid, opt_pretty=True) - get_webhook: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.webhooks.get_webhook(webhook_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_webhooks: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.webhooks.get_webhooks({'param': 'value', 'param': 'value'}, opt_pretty=True) - update_webhook: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.webhooks.update_webhook(webhook_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/samples/workspace_memberships_sample.yaml b/samples/workspace_memberships_sample.yaml deleted file mode 100644 index 0901c48f..00000000 --- a/samples/workspace_memberships_sample.yaml +++ /dev/null @@ -1,25 +0,0 @@ -workspacememberships: - get_workspace_membership: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.workspace_memberships.get_workspace_membership(workspace_membership_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_workspace_memberships_for_user: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.workspace_memberships.get_workspace_memberships_for_user(user_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_workspace_memberships_for_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.workspace_memberships.get_workspace_memberships_for_workspace(workspace_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) diff --git a/samples/workspaces_sample.yaml b/samples/workspaces_sample.yaml deleted file mode 100644 index cff9a078..00000000 --- a/samples/workspaces_sample.yaml +++ /dev/null @@ -1,41 +0,0 @@ -workspaces: - add_user_for_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.workspaces.add_user_for_workspace(workspace_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - get_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.workspaces.get_workspace(workspace_gid, {'param': 'value', 'param': 'value'}, opt_pretty=True) - get_workspaces: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.workspaces.get_workspaces({'param': 'value', 'param': 'value'}, opt_pretty=True) - remove_user_for_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.workspaces.remove_user_for_workspace(workspace_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) - update_workspace: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.workspaces.update_workspace(workspace_gid, {'field': 'value', 'field': 'value'}, opt_pretty=True) diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index ed8a958e..00000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[bdist_wheel] -universal = 1 - -[metadata] -license_file = LICENSE diff --git a/setup.py b/setup.py deleted file mode 100755 index b695d5d9..00000000 --- a/setup.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python - -import sys -import os -from setuptools import setup, find_packages - -assert sys.version_info >= (3, 7), 'We only support Python 3.7+' - -sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'asana')) - -# Safely read the version number from the version.py file -version = {} -with open('asana/version.py') as fp: - exec(fp.read(), version) - -with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: - long_description = readme.read() - -setup( - name='asana', - version=version['__version__'], - description='Asana API client', - long_description=long_description, - long_description_content_type='text/markdown', - license='MIT', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Natural Language :: English', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7' - ], - install_requires=[ - 'requests >= 2.20.0, == 2.*', - 'requests_oauthlib >= 0.8.0, <2.0', - ], - author='Asana, Inc', - # author_email='', - url='http://github.com/asana/python-asana', - packages=find_packages(exclude=('tests', 'examples')), - keywords='asana', - zip_safe=True, - test_suite='tests') diff --git a/swagger_templates/api.mustache b/swagger_templates/api.mustache deleted file mode 100644 index 52d17b33..00000000 --- a/swagger_templates/api.mustache +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -{{#operations}} -class _{{classname}}: - - def __init__(self, client=None): - self.client = client -{{#operation}}{{^formParams}} -{{#contents}} - - def {{operationId}}(self, {{#pathParams}}{{paramName}}, {{/pathParams}}params=None, **options): - """{{#summary}}{{{.}}}{{/summary}}{{^summary}}{{operationId}}{{/summary}} - {{#pathParams}} - :param {{dataType}} {{paramName}}:{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}{{#description}} {{{description}}}{{/description}} - {{/pathParams}} - :param Object params: Parameters for the request{{#queryParams}}{{#neq baseName 'opt_pretty' 'opt_fields' 'offset' 'limit'}} - - {{paramName}} { {{~dataType~}} }: {{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}{{#description}} {{{description}}}{{/description}}{{/neq}}{{/queryParams}} - :param **options{{#queryParams}}{{#eq baseName 'opt_pretty' 'opt_fields' 'offset' 'limit'}} - - {{paramName}} { {{~dataType~}} }: {{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}{{#description}} {{{description}}}{{/description}}{{/eq}}{{/queryParams}} - :return: Object - """ - if params is None: - params = {} - path = "{{path}}"{{#pathParams}}.replace("{ {{~baseName~}} }", {{paramName}}){{/pathParams}} - return self.client.{{#neq "GET" httpMethod}}{{toLowerCase httpMethod}}{{/neq}}{{#eq "GET" httpMethod}}{{returnContainer}}{{/eq}}(path, params, **options) -{{/contents}} -{{/formParams}}{{/operation}} -{{/operations}} diff --git a/swagger_templates/api_doc.mustache b/swagger_templates/api_doc.mustache deleted file mode 100644 index 46e46411..00000000 --- a/swagger_templates/api_doc.mustache +++ /dev/null @@ -1,10 +0,0 @@ -{{#operations}}{{toLowerCase classname}}: {{#operation}}{{#contents}} - {{operationId}}: >- - import asana - - - client = asana.Client.access_token('PERSONAL_ACCESS_TOKEN') - - - result = client.{{toLowerCase baseName}}.{{operationId}}({{#pathParams}}{{paramName}}, {{/pathParams}}{{#neq "GET" httpMethod}}{{#neq "DELETE" httpMethod}}{'field': 'value', 'field': 'value'}, {{/neq}}{{/neq}}{{#eq "GET" httpMethod}}{'param': 'value', 'param': 'value'}, {{/eq}}opt_pretty=True){{/contents}}{{/operation}} -{{/operations}} diff --git a/swagger_templates/python-config.json b/swagger_templates/python-config.json deleted file mode 100644 index af0ec379..00000000 --- a/swagger_templates/python-config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "packageName" : "asana", - "templateDir": "swagger_templates", - "hideGenerationTimestamp": true, - "apiTests": false -} diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/helpers.py b/tests/helpers.py deleted file mode 100644 index 5167c04b..00000000 --- a/tests/helpers.py +++ /dev/null @@ -1,40 +0,0 @@ -import json -import unittest - -import asana -import requests -import responses -from responses import GET, PUT, POST, DELETE - -# Define JSON primitives so we can just copy in JSON: -false = False -true = True -null = None - - -def create_decorating_metaclass(decorators, prefix='test_'): - class DecoratingMethodsMetaclass(type): - def __new__(cls, name, bases, namespace): - namespace_items = tuple(namespace.items()) - for key, val in namespace_items: - if key.startswith(prefix) and callable(val): - for dec in decorators: - val = dec(val) - namespace[key] = val - return type.__new__(cls, name, bases, dict(namespace)) - - return DecoratingMethodsMetaclass - - -# TestCase subclass that automatically decorates test methods with -# responses.activate and sets up a client instance -class ClientTestCase(unittest.TestCase, metaclass=create_decorating_metaclass((responses.activate,))): - - def setUp(self): - self.client = asana.Client( - base_url='http://app', - # no delay when polling to speed up tests - poll_interval=0, - # disable iterator and limit to match existing tests for now - iterator_type=None, - ) diff --git a/tests/test_client.py b/tests/test_client.py deleted file mode 100644 index 9dd1c62f..00000000 --- a/tests/test_client.py +++ /dev/null @@ -1,407 +0,0 @@ -import warnings -try: - from mock import patch, call -except ImportError: - from unittest.mock import patch, call - -from .helpers import * - -class TestClient(ClientTestCase): - - def test_version_values(self): - values = self.client._version_values() - self.assertEqual('Python', values['language']) - self.assertRegex(values['version'], r'[0-9]+[.][0-9]+[.][0-9]+') - self.assertSetEqual( - {'language', 'version', 'language_version', 'os', 'os_version'}, - set(values.keys())) - - def test_version_header(self): - self.assertRegex( - self.client._version_header(), r'language=Python') - - def test_default_headers(self): - self.client.headers['key'] = 'value' - responses.add(GET, 'http://app/users/me', status=200, body='{"data":{}}') - self.client.users.get_user('me') - self.assertLessEqual( - set({'key': 'value'}.items()), - set(responses.calls[0].request.headers.items()) - ) - - def test_request_headers(self): - responses.add(GET, 'http://app/users/me', status=200, body='{"data":{}}') - self.client.users.get_user('me', headers={'key': 'value'}) - self.assertLessEqual( - set({'key': 'value'}.items()), - set(responses.calls[0].request.headers.items()) - ) - - def test_overriding_headers(self): - self.client.headers['key'] = 'value' - self.client.headers['key2'] = 'value2' - responses.add(GET, 'http://app/users/me', status=200, body='{"data":{}}') - self.client.users.get_user('me', headers={'key2': 'value3'}) - self.assertLessEqual( - set({'key': 'value', 'key2': 'value3'}.items()), - set(responses.calls[0].request.headers.items()) - ) - - def test_content_type_headers(self): - self.client.headers['key'] = 'value' - responses.add(POST, 'http://app/tasks/123/addProject', status=200, - body='{"data":{}}') - self.client.tasks.add_project(123, project=456, headers={'key2': 'value2'}) - self.assertLessEqual( - set({'content-type': 'application/json'}.items()), - set(responses.calls[0].request.headers.items()) - ) - - def test_users_me_not_authorized(self): - res = { - "errors": [ - { "message": "Not Authorized" } - ] - } - responses.add(GET, 'http://app/users/me', status=401, body=json.dumps(res), match_querystring=True) - self.assertRaises(asana.error.NoAuthorizationError, self.client.users.get_user, 'me') - - def test_tasks_get_tasks_invalid_request(self): - res = { - "errors": [ - { "message": "workspace: Missing input" } - ] - } - responses.add(GET, 'http://app/tasks', status=400, body=json.dumps(res), match_querystring=True) - self.assertRaises(asana.error.InvalidRequestError, self.client.tasks.get_tasks) - - def test_users_me_server_error(self): - res = { - "errors": [ - { - "message": "Server Error", - "phrase": "6 sad squid snuggle softly" - } - ] - } - responses.add(GET, 'http://app/users/me', status=500, body=json.dumps(res), match_querystring=True) - self.assertRaises(asana.error.ServerError, self.client.users.get_user, 'me', max_retries=0) - - def test_users_me_unfriendly_server_error(self): - res = "Crappy Response" - responses.add(GET, 'http://app/users/me', status=504, body=res, match_querystring=True) - self.assertRaises(asana.error.ServerError, self.client.users.get_user, 'me', max_retries=0) - - def test_users_get_user_not_found(self): - res = { - "errors": [ - { "message": "user: Unknown object: 1234124312341" } - ] - } - responses.add(GET, 'http://app/users/1234', status=404, body=json.dumps(res), match_querystring=True) - self.assertRaises(asana.error.NotFoundError, self.client.users.get_user, ('1234')) - - def test_users_get_user_forbidden(self): - res = { - "errors": [ - { "message": "user: Forbidden" } - ] - } - responses.add(GET, 'http://app/users/1234', status=403, body=json.dumps(res), match_querystring=True) - self.assertRaises(asana.error.ForbiddenError, self.client.users.get_user, ('1234')) - - def test_option_pretty(self): - res = { - "data": { "email": "sanchez@...", "id": 999, "name": "Greg Sanchez" } - } - responses.add(GET, 'http://app/users/me?opt_pretty=true', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.users.get_user('me', pretty=True), res['data']) - - def test_option_fields(self): - res = { - "data": { "name": "Make a list", "notes": "Check it twice!", "id": 1224 } - } - responses.add(GET, 'http://app/tasks/1224?opt_fields=name%2Cnotes', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.get_task('1224', fields=['name','notes']), res['data']) - - def test_option_expand(self): - req = { - 'data': { 'assignee': 1234 }, - 'options': { 'expand' : ['projects'] } - } - res = { - "data": { - "id": 1001, - "projects": [ - { - "archived": false, - "created_at": "", - "followers": [], - "modified_at": "", - "notes": "", - "id": 1331, - "name": "Things to buy" - } - ] - # ... - } - } - responses.add(PUT, 'http://app/tasks/1001', status=200, body=json.dumps(res), match_querystring=True) - # -d "assignee=1234" \ - # -d "options.expand=%2Aprojects%2A" - self.assertEqual(self.client.tasks.update_task('1001', req['data'], expand=['projects']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_pagination(self): - res = { - "data": [ - { "id": 1000, "name": "Task 1" } - ], - "next_page": { - "offset": "yJ0eXAiOiJKV1QiLCJhbGciOiJIRzI1NiJ9", - "path": "/tasks?project=1337&limit=5&offset=yJ0eXAiOiJKV1QiLCJhbGciOiJIRzI1NiJ9", - "uri": "https://app.asana.com/api/1.0/tasks?project=1337&limit=5&offset=yJ0eXAiOiJKV1QiLCJhbGciOiJIRzI1NiJ9" - } - } - responses.add(GET, 'http://app/projects/1337/tasks?limit=5&offset=eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9', status=200, body=json.dumps(res), match_querystring=True) - - self.assertEqual(self.client.tasks.get_tasks_for_project('1337', { 'limit': 5, 'offset': 'eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9'}), res['data']) - - @unittest.skip("iterator_type='pages' disabled") - def test_page_iterator_item_limit_lt_items(self): - responses.add(GET, 'http://app/projects/1337/tasks?limit=2', status=200, body=json.dumps({ 'data': ['a', 'b'], 'next_page': { 'offset': 'a', 'path': '/projects/1337/tasks?limit=2&offset=a' } }), match_querystring=True) - responses.add(GET, 'http://app/projects/1337/tasks?limit=2&offset=a', status=200, body=json.dumps({ 'data': ['c'], 'next_page': null }), match_querystring=True) - - iterator = self.client.tasks.get_tasks_for_project('1337', item_limit=2, page_size=2, iterator_type='pages') - self.assertEqual(next(iterator), ['a', 'b']) - self.assertRaises(StopIteration, next, (iterator)) - - @unittest.skip("iterator_type='pages' disabled") - def test_page_iterator_item_limit_eq_items(self): - responses.add(GET, 'http://app/projects/1337/tasks?limit=2', status=200, body=json.dumps({ 'data': ['a', 'b'], 'next_page': { 'offset': 'a', 'path': '/projects/1337/tasks?limit=2&offset=a' } }), match_querystring=True) - responses.add(GET, 'http://app/projects/1337/tasks?limit=1&offset=a', status=200, body=json.dumps({ 'data': ['c'], 'next_page': null }), match_querystring=True) - - iterator = self.client.tasks.get_tasks_for_project('1337', item_limit=3, page_size=2, iterator_type='pages') - self.assertEqual(next(iterator), ['a', 'b']) - self.assertEqual(next(iterator), ['c']) - self.assertRaises(StopIteration, next, (iterator)) - - @unittest.skip("iterator_type='pages' disabled") - def test_page_iterator_item_limit_gt_items(self): - responses.add(GET, 'http://app/projects/1337/tasks?limit=2', status=200, body=json.dumps({ 'data': ['a', 'b'], 'next_page': { 'offset': 'a', 'path': '/projects/1337/tasks?limit=2&offset=a' } }), match_querystring=True) - responses.add(GET, 'http://app/projects/1337/tasks?limit=2&offset=a', status=200, body=json.dumps({ 'data': ['c'], 'next_page': null }), match_querystring=True) - - iterator = self.client.tasks.get_tasks_for_project('1337', item_limit=4, page_size=2, iterator_type='pages') - self.assertEqual(next(iterator), ['a', 'b']) - self.assertEqual(next(iterator), ['c']) - self.assertRaises(StopIteration, next, (iterator)) - - def test_item_iterator_item_limit_lt_items(self): - responses.add(GET, 'http://app/projects/1337/tasks?limit=2', status=200, body=json.dumps({ 'data': ['a', 'b'], 'next_page': { 'offset': 'a', 'path': '/projects/1337/tasks?limit=2&offset=a' } }), match_querystring=True) - - iterator = self.client.tasks.get_tasks_for_project('1337', item_limit=2, page_size=2, iterator_type='items') - self.assertEqual(next(iterator), 'a') - self.assertEqual(next(iterator), 'b') - self.assertRaises(StopIteration, next, (iterator)) - - def test_item_iterator_item_limit_eq_items(self): - responses.add(GET, 'http://app/projects/1337/tasks?limit=2', status=200, body=json.dumps({ 'data': ['a', 'b'], 'next_page': { 'offset': 'a', 'path': '/projects/1337/tasks?limit=2&offset=a' } }), match_querystring=True) - responses.add(GET, 'http://app/projects/1337/tasks?limit=1&offset=a', status=200, body=json.dumps({ 'data': ['c'], 'next_page': null }), match_querystring=True) - - iterator = self.client.tasks.get_tasks_for_project('1337', item_limit=3, page_size=2, iterator_type='items') - self.assertEqual(next(iterator), 'a') - self.assertEqual(next(iterator), 'b') - self.assertEqual(next(iterator), 'c') - self.assertRaises(StopIteration, next, (iterator)) - - def test_item_iterator_item_limit_gt_items(self): - responses.add(GET, 'http://app/projects/1337/tasks?limit=2', status=200, body=json.dumps({ 'data': ['a', 'b'], 'next_page': { 'offset': 'a', 'path': '/projects/1337/tasks?limit=2&offset=a' } }), match_querystring=True) - responses.add(GET, 'http://app/projects/1337/tasks?limit=2&offset=a', status=200, body=json.dumps({ 'data': ['c'], 'next_page': null }), match_querystring=True) - - iterator = self.client.tasks.get_tasks_for_project('1337', item_limit=4, page_size=2, iterator_type='items') - self.assertEqual(next(iterator), 'a') - self.assertEqual(next(iterator), 'b') - self.assertEqual(next(iterator), 'c') - self.assertRaises(StopIteration, next, (iterator)) - - def test_item_iterator_preserve_opt_fields(self): - responses.add(GET, 'http://app/projects/1337/tasks?limit=2&opt_fields=foo', status=200, body=json.dumps({ 'data': ['a', 'b'], 'next_page': { 'offset': 'a', 'path': '/projects/1337/tasks?limit=2&offset=a' } }), match_querystring=True) - responses.add(GET, 'http://app/projects/1337/tasks?limit=1&opt_fields=foo&offset=a', status=200, body=json.dumps({ 'data': ['c'], 'next_page': null }), match_querystring=True) - - iterator = self.client.tasks.get_tasks_for_project('1337', item_limit=3, page_size=2, fields=['foo'], iterator_type='items') - self.assertEqual(next(iterator), 'a') - self.assertEqual(next(iterator), 'b') - self.assertEqual(next(iterator), 'c') - self.assertRaises(StopIteration, next, (iterator)) - - @patch('time.sleep') - def test_rate_limiting(self, time_sleep): - res = [ - (429, { 'Retry-After': '10' }, '{}'), - (200, {}, json.dumps({ 'data': 'me' })) - ] - responses.add_callback(responses.GET, 'http://app/users/me', callback=lambda r: res.pop(0), content_type='application/json') - - self.assertEqual(self.client.users.get_user('me'), 'me') - self.assertEqual(len(responses.calls), 2) - self.assertEqual(time_sleep.mock_calls, [call(10.0)]) - - @patch('time.sleep') - def test_rate_limited_twice(self, time_sleep): - res = [ - (429, { 'Retry-After': '10' }, '{}'), - (429, { 'Retry-After': '1' }, '{}'), - (200, {}, json.dumps({ 'data': 'me' })) - ] - responses.add_callback(responses.GET, 'http://app/users/me', callback=lambda r: res.pop(0), content_type='application/json') - - self.assertEqual(self.client.users.get_user('me'), 'me') - self.assertEqual(len(responses.calls), 3) - self.assertEqual(time_sleep.mock_calls, [call(10.0), call(1.0)]) - - @patch('time.sleep') - def test_server_error_retry(self, time_sleep): - res = [ - (500, {}, '{}'), - (500, {}, '{}'), - (500, {}, '{}'), - (200, {}, json.dumps({ 'data': 'me' })) - ] - responses.add_callback(responses.GET, 'http://app/users/me', callback=lambda r: res.pop(0), content_type='application/json') - - self.assertRaises(asana.error.ServerError, self.client.users.get_user, 'me', max_retries=2) - self.assertEqual(time_sleep.mock_calls, [call(1.0), call(2.0)]) - - @patch('time.sleep') - def test_server_error_retry_backoff(self, time_sleep): - res = [ - (500, {}, '{}'), - (500, {}, '{}'), - (500, {}, '{}'), - (200, {}, json.dumps({ 'data': 'me' })) - ] - responses.add_callback(responses.GET, 'http://app/users/me', callback=lambda r: res.pop(0), content_type='application/json') - - self.assertEqual(self.client.users.get_user('me'), 'me') - self.assertEqual(time_sleep.mock_calls, [call(1.0), call(2.0), call(4.0)]) - - - def test_get_named_parameters(self): - responses.add(GET, 'http://app/tasks?workspace=14916&assignee=me', status=200, body=json.dumps({ 'data': 'dummy data' }), match_querystring=True) - - self.assertEqual(self.client.tasks.get_tasks(workspace=14916, assignee="me"), 'dummy data') - - def test_post_named_parameters(self): - responses.add(POST, 'http://app/tasks', status=201, body='{ "data": "dummy data" }', match_querystring=True) - - self.assertEqual(self.client.tasks.create_task(assignee=1235, followers=[5678], name="Hello, world."), 'dummy data') - self.assertEqual(json.loads(responses.calls[0].request.body), { - "data": { - "assignee": 1235, - "followers": [5678], - "name": "Hello, world." - } - }) - - def test_put_named_parameters(self): - responses.add(PUT, 'http://app/tasks/1001', status=200, body='{ "data": "dummy data" }', match_querystring=True) - - self.assertEqual(self.client.tasks.update_task('1001', assignee=1235, followers=[5678], name="Hello, world."), 'dummy data') - self.assertEqual(json.loads(responses.calls[0].request.body), { - "data": { - "assignee": 1235, - "followers": [5678], - "name": "Hello, world." - } - }) - - def test_asana_change_header_logging(self): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - - requestHeaders = {} - responseHeaders = { - 'asana-change': 'name=string_ids;info=something;affected=true' - } - self.client._log_asana_change_header(requestHeaders, responseHeaders) - - assert len(w) == 1 - - def test_asana_change_header_logging_turned_off(self): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - - requestHeaders = {} - responseHeaders = { - 'asana-change': 'name=string_ids;info=something;affected=true' - } - self.client.LOG_ASANA_CHANGE_WARNINGS = false - self.client._log_asana_change_header(requestHeaders, responseHeaders) - - assert len(w) == 0 - - def test_asana_change_header_ignore_case(self): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - - requestHeaders = {} - responseHeaders = { - 'asANa-chANge': 'name=string_ids;info=something;affected=true' - } - self.client._log_asana_change_header(requestHeaders, responseHeaders) - - assert len(w) == 1 - - def test_asana_change_header_enable(self): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - - requestHeaders = { - 'asana-enable': 'string_ids' - } - responseHeaders = { - 'asana-change': 'name=string_ids;info=something;affected=true' - } - self.client._log_asana_change_header(requestHeaders, responseHeaders) - - assert len(w) == 0 - - def test_asana_change_header_disable(self): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - - requestHeaders = { - 'asana-disable': 'string_ids' - } - responseHeaders = { - 'asana-change': 'name=string_ids;info=something;affected=true' - } - self.client._log_asana_change_header(requestHeaders, responseHeaders) - - assert len(w) == 0 - - def test_asana_change_header_multiple(self): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - - requestHeaders = {} - responseHeaders = { - 'asana-change': 'name=string_ids;info=something;affected=true,name=new_sections;info=something;affected=true' - } - self.client._log_asana_change_header(requestHeaders, responseHeaders) - - assert len(w) == 2 - - def test_asana_change_header_multiple_disable(self): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - - requestHeaders = { - 'asana-disable': 'string_ids,new_sections' - } - responseHeaders = { - 'asana-change': 'name=string_ids;info=something;affected=true,name=new_sections;info=something;affected=true' - } - self.client._log_asana_change_header(requestHeaders, responseHeaders) - - assert len(w) == 0 diff --git a/tests/test_client_attachments.py b/tests/test_client_attachments.py deleted file mode 100644 index 6affeb81..00000000 --- a/tests/test_client_attachments.py +++ /dev/null @@ -1,46 +0,0 @@ -import io -import cgi - -from .helpers import * - - -class TestClientAttachments(ClientTestCase): - - def test_attachments_get_attachment(self): - res = { - "data": { - "created_at": "", - "download_url": "https://www.dropbox.com/s/1234567890abcdef/Screenshot.png?dl=1", - "host": "dropbox", - "id": 5678, - "name": "Screenshot.png", - "parent": { "id": 1337, "name": "My Task" }, - "view_url": "https://www.dropbox.com/s/1234567890abcdef/Screenshot.png" - } - } - responses.add(GET, 'http://app/attachments/5678', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.attachments.get_attachment('5678'), res['data']) - - def test_attachments_find_by_task(self): - res = { - "data": [ - { "id": 5678, "name": "Background.png" }, - { "id": 9012, "name": "New Design Draft.pdf" } - ] - } - responses.add(GET, 'http://app/tasks/1234/attachments', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.attachments.find_by_task('1234'), res['data']) - - def test_attachments_create_on_task(self): - res = { "data": { "id": 5678, "name": "file.txt" } } - responses.add(POST, 'http://app/tasks/1337/attachments', status=200, body=json.dumps(res), match_querystring=True) - - self.assertEqual(self.client.attachments.create_on_task('1337', 'file content', 'file name', 'file content-type'), res['data']) - - request_content_type, pdict = cgi.parse_header(responses.calls[0].request.headers['Content-Type']) - self.assertEqual(request_content_type, 'multipart/form-data') - - content_file = io.BytesIO(responses.calls[0].request.body) - multipart = cgi.parse_multipart(content_file, { 'boundary': bytes(pdict['boundary'], "UTF-8") }) - self.assertEqual(multipart['file'][0], bytes('file content', 'UTF-8')) - # TODO: verify filename and content-type, possibly using a different multipart decoder diff --git a/tests/test_client_audit_log_api.py b/tests/test_client_audit_log_api.py deleted file mode 100644 index ca0dc9fe..00000000 --- a/tests/test_client_audit_log_api.py +++ /dev/null @@ -1,152 +0,0 @@ -from .helpers import * - - -class TestClientAuditLogAPI(ClientTestCase): - - def test_get_audit_log_events(self): - res = { - "data": [ - { - "actor": { - "actor_type": "user", - "email": "gregsanchez@example.com", - "gid": "1111", - "name": "Greg Sanchez" - }, - "context": { - "api_authentication_method": "cookie", - "client_ip_address": "1.1.1.1", - "context_type": "web", - "oauth_app_name": "string", - "user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" - }, - "created_at": "2021-01-01T00:00:00.000Z", - "details": {}, - "event_category": "deletion", - "event_type": "task_deleted", - "gid": "12345", - "resource": { - "email": "string", - "gid": "1111", - "name": "Example Task", - "resource_subtype": "milestone", - "resource_type": "task" - } - } - ], - "next_page": { - "offset": "a", - "path": "/workspaces/1337/audit_log_events?offset=a", - "uri": "https://app.asana.com/api/1.0/workspaces/1337/audit_log_events?offset=a" - } - } - responses.add(GET, 'http://app/workspaces/1337/audit_log_events?', - status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual( - self.client.audit_log_api.get_audit_log_events("1337"), res['data']) - - def test_get_audit_log_events_iterator(self): - res1 = { - "data": [ - { - "actor": { - "actor_type": "user", - "email": "gregsanchez@example.com", - "gid": "1111", - "name": "Greg Sanchez" - }, - "context": { - "api_authentication_method": "cookie", - "client_ip_address": "1.1.1.1", - "context_type": "web", - "oauth_app_name": "string", - "user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" - }, - "created_at": "2021-01-01T00:00:00.000Z", - "details": {}, - "event_category": "deletion", - "event_type": "task_deleted", - "gid": "12345", - "resource": { - "email": "string", - "gid": "1111", - "name": "Example Task", - "resource_subtype": "milestone", - "resource_type": "task" - } - } - ], - "next_page": { - "offset": "a", - "path": "/workspaces/1337/audit_log_events?limit=1&offset=a", - "uri": "https://app.asana.com/api/1.0/workspaces/1337/audit_log_events?limit=1&offset=a" - } - } - res2 = { - "data": [ - { - "actor": { - "actor_type": "user", - "email": "tbizarro@example.com", - "gid": "1234", - "name": "Tim Bizarro" - }, - "context": { - "api_authentication_method": "cookie", - "client_ip_address": "1.1.1.1", - "context_type": "web", - "oauth_app_name": "string", - "user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" - }, - "created_at": "2021-01-01T00:00:00.000Z", - "details": {}, - "event_category": "deletion", - "event_type": "task_deleted", - "gid": "12345", - "resource": { - "email": "string", - "gid": "1111", - "name": "Example Task", - "resource_subtype": "milestone", - "resource_type": "task" - } - } - ], - "next_page": { - "offset": "b", - "path": "/workspaces/1337/audit_log_events?limit=1&offset=b", - "uri": "https://app.asana.com/api/1.0/workspaces/1337/audit_log_events?limit=1&offset=b" - } - } - res3 = { - "data": [], - "next_page": { - "offset": "c", - "path": "/workspaces/1337/audit_log_events?limit=1&offset=c", - "uri": "https://app.asana.com/api/1.0/workspaces/1337/audit_log_events?limit=1&offset=c" - } - } - res4 = { - "data": [], - "next_page": { - "offset": "d", - "path": "/workspaces/1337/audit_log_events?limit=1&offset=d", - "uri": "https://app.asana.com/api/1.0/workspaces/1337/audit_log_events?limit=1&offset=d" - } - } - responses.add(GET, 'http://app/workspaces/1337/audit_log_events?limit=1', - status=200, body=json.dumps(res1), match_querystring=True) - responses.add(GET, 'http://app/workspaces/1337/audit_log_events?limit=1&offset=a', - status=200, body=json.dumps(res2), match_querystring=True) - responses.add(GET, 'http://app/workspaces/1337/audit_log_events?limit=1&offset=b', - status=200, body=json.dumps(res3), match_querystring=True) - responses.add(GET, 'http://app/workspaces/1337/audit_log_events?limit=1&offset=c', - status=200, body=json.dumps(res4), match_querystring=True) - # Set iterator_type to 'items' to return an iterator - iterator = self.client.audit_log_api.get_audit_log_events( - "1337", page_size=1, iterator_type='items' - ) - # Iterator should stop on third call - self.assertEqual(next(iterator), res1['data'][0]) - self.assertEqual(next(iterator), res2['data'][0]) - self.assertRaises(StopIteration, next, (iterator)) diff --git a/tests/test_client_custom_field_settings.py b/tests/test_client_custom_field_settings.py deleted file mode 100644 index 506ccc2b..00000000 --- a/tests/test_client_custom_field_settings.py +++ /dev/null @@ -1,43 +0,0 @@ -from .helpers import * - -class TestClientCustomFieldSettings(ClientTestCase): - def test_custom_field_settings_get_custom_field_settings_for_project(self): - res = { - "data": [ - { - "id": 258147, - "custom_field": [ - { - "id": 124578, - "name": "Priority", - "type": "enum" - } - ], - "project": [ - { - "id": 1331, - "name": "Things to buy" - } - ] - }, - { - "id": 369852, - "custom_field": [ - { - "id": 235689, - "name": "Cost", - "type": "enum" - } - ], - "project": [ - { - "id": 1331, - "name": "Things to buy" - } - ] - }, - ] - } - responses.add(GET, 'http://app/projects/1331/custom_field_settings', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.custom_field_settings.get_custom_field_settings_for_project('1331'), res['data']) - diff --git a/tests/test_client_custom_fields.py b/tests/test_client_custom_fields.py deleted file mode 100644 index e7b0d0a8..00000000 --- a/tests/test_client_custom_fields.py +++ /dev/null @@ -1,65 +0,0 @@ -from .helpers import * - -class TestClientCustomFields(ClientTestCase): - def test_custom_fields_get_custom_field_text(self): - res = { - "data": [ - { - "id": 134679, - "created_at": "2016-07-11T14:29:23.249Z", - "name": "Owner", - "type": "text" - } - ] - } - responses.add(GET, 'http://app/custom_fields/134679', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.custom_fields.get_custom_field('134679'), res['data']) - - def test_custom_fields_get_custom_field_enum(self): - res = { - "data": [ - { - "id": 124578, - "created_at": "2016-07-11T14:29:23.249Z", - "name": "Priority", - "type": "enum", - "enum_options": [ - { - "id": 789, - "name": "Low", - "enabled": true, - "color": "blue" - }, - { - "id": 208, - "name": "Medium", - "enabled": false, - "color": "yellow" - }, - { - "id": 439, - "name": "High", - "enabled": true, - "color": "red" - } - ] - } - ] - } - responses.add(GET, 'http://app/custom_fields/124578', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.custom_fields.get_custom_field('124578'), res['data']) - - def test_custom_fields_get_custom_field_number(self): - res = { - "data": [ - { - "id": 938271, - "created_at": "2016-07-11T14:29:23.249Z", - "name": "Price", - "type": "number", - "precision": 2 - } - ] - } - responses.add(GET, 'http://app/custom_fields/938271', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.custom_fields.get_custom_field('938271'), res['data']) diff --git a/tests/test_client_events.py b/tests/test_client_events.py deleted file mode 100644 index 145a97d6..00000000 --- a/tests/test_client_events.py +++ /dev/null @@ -1,78 +0,0 @@ -from .helpers import * - -class TestClientEvents(ClientTestCase): - - def test_events_get(self): - res = { - "data": [ - { - "action": "changed", - "created_at": "2013-08-21T18:20:37.972Z", - "parent": null, - "resource": { "id": 1337, "name": "My Task" }, - "type": "task", - "user": { "id": 1123, "name": "Tom Bizarro" } - }, - { - "action": "changed", - "created_at": "2013-08-21T18:22:45.421Z", - "parent": null, - "resource": { "id": 1338, "name": "My Other Task" }, - "type": "task", - "user": { "id": 1428, "name": "Greg Sanchez" } - } - ], - "sync": "edfc0896b370b7a479886d316131bf5c:0" - } - responses.add(GET, 'http://app/events?resource=14321&sync=de4774f6915eae04714ca93bb2f5ee81%3A3', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.events.get({ 'resource': 14321, 'sync': 'de4774f6915eae04714ca93bb2f5ee81:3' }), res) - - def test_project_events_get_invalid_token(self): - res = { - "message": "Sync token invalid or too old. If you are attemping to keep resources in sync, you must re-fetch the full dataset for this query now.", - "sync": "edfc0896b370b7a479886d316131bf5c:0" - } - responses.add(GET, 'http://app/events?resource=3214312&sync=de4774f6915eae04714ca93bb2f5ee81%3A3', status=412, body=json.dumps(res), match_querystring=True) - # responses.add(GET, 'http://app/project/3214312/events?sync=de4774f6915eae04714ca93bb2f5ee81%3A3', status=412, body=json.dumps(res), match_querystring=True) - self.assertRaises(asana.error.InvalidTokenError, self.client.events.get, ({ 'resource': 3214312, 'sync': 'de4774f6915eae04714ca93bb2f5ee81:3' })) - # self.assertEqual(self.client.events.get({ 'resource': 3214312, 'sync': 'de4774f6915eae04714ca93bb2f5ee81:3' }), res) - - def test_project_events_get_next(self): - responses.add(GET, 'http://app/events?resource=1', status=412, body=json.dumps({ "sync": "1" }), match_querystring=True) - responses.add(GET, 'http://app/events?resource=1&sync=1', status=200, body=json.dumps({ "data": [], "sync": "2" }), match_querystring=True) - responses.add(GET, 'http://app/events?resource=1&sync=2', status=200, body=json.dumps({ "data": [{}, {}, {}], "sync": "3" }), match_querystring=True) - - self.assertEqual(len(self.client.events.get_next({ "resource": "1" })[0]), 3) - - def test_project_events_get_next_unknown_object(self): - responses.add(GET, 'http://app/events?resource=1', status=400, body=json.dumps({ "sync": "1" }), match_querystring=True) - - self.assertRaises(asana.error.InvalidRequestError, self.client.events.get_next, ({ "resource": 1 })) - - def test_project_events_get_next_invalid_token(self): - responses.add(GET, 'http://app/events?resource=1&sync=invalid', status=412, body=json.dumps({ "sync": "1" }), match_querystring=True) - - self.assertRaises(asana.error.InvalidTokenError, self.client.events.get_next, ({ "resource": 1, "sync": "invalid" })) - - def test_project_events_get_iterator(self): - responses.add(GET, 'http://app/events?resource=1', status=412, body=json.dumps({ "sync": "1" }), match_querystring=True) - responses.add(GET, 'http://app/events?resource=1&sync=1', status=200, body=json.dumps({ "data": [], "sync": "2" }), match_querystring=True) - responses.add(GET, 'http://app/events?resource=1&sync=2', status=200, body=json.dumps({ "data": ['a', 'b'], "sync": "3" }), match_querystring=True) - responses.add(GET, 'http://app/events?resource=1&sync=3', status=200, body=json.dumps({ "data": ['c'], "sync": "4" }), match_querystring=True) - - iterator = self.client.events.get_iterator({ "resource": "1" }) - self.assertEqual(next(iterator), 'a') - self.assertEqual(next(iterator), 'b') - self.assertEqual(next(iterator), 'c') - - def test_project_events_get_iterator_unknown_object(self): - responses.add(GET, 'http://app/events?resource=1', status=400, body=json.dumps({ "sync": "1" }), match_querystring=True) - - iterator = self.client.events.get_iterator({ "resource": 1 }) - self.assertRaises(asana.error.InvalidRequestError, next, (iterator)) - - def test_project_events_get_iterator_invalid_token(self): - responses.add(GET, 'http://app/events?resource=1&sync=invalid', status=412, body=json.dumps({ "sync": "1" }), match_querystring=True) - - iterator = self.client.events.get_iterator({ "resource": 1, "sync": "invalid" }) - self.assertRaises(asana.error.InvalidTokenError, next, (iterator)) diff --git a/tests/test_client_jobs.py b/tests/test_client_jobs.py deleted file mode 100644 index bbd69588..00000000 --- a/tests/test_client_jobs.py +++ /dev/null @@ -1,13 +0,0 @@ -from .helpers import * - -class TestClientJobs(ClientTestCase): - def test_jobs_get_job(self): - res = { - "data": { - "id": 1331, - "name": "Things to Buy" - } - } - responses.add(GET, 'http://app/jobs/1331', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.jobs.get_job('1331'), res['data']) - diff --git a/tests/test_client_organization_exports.py b/tests/test_client_organization_exports.py deleted file mode 100644 index b768c2c3..00000000 --- a/tests/test_client_organization_exports.py +++ /dev/null @@ -1,40 +0,0 @@ -import json - -import responses - -from .helpers import ClientTestCase, GET, DELETE, POST, PUT - - -class TestClientOrganizationExports(ClientTestCase): - def test_organization_exports_get_organization_export(self): - resp = { - "data": { - "id": 1234, - "created_at": '2012-02-22T02:06:58.147Z', - "download_url": - 'https://asana-export.s3.amazonaws.com/export-1.json.gz', - "state": "pending", - "organization": { - "id": 14916, "name": "My Workspace" - } - } - } - - responses.add( - GET, 'http://app/organization_exports/1234', status=200, - body=json.dumps(resp), match_querystring=True) - self.assertEqual( - self.client.organization_exports.get_organization_export('1234'), resp['data']) - - def test_organization_exports_create_organization_export(self): - resp = { - "data": { - "organization": 14916 - } - } - - responses.add( - POST, 'http://app/organization_exports', status=200, - body=json.dumps(resp), match_querystring=True) - self.assertEqual( - self.client.organization_exports.create_organization_export(), resp['data']) diff --git a/tests/test_client_portfolio_memberships.py b/tests/test_client_portfolio_memberships.py deleted file mode 100644 index 84293080..00000000 --- a/tests/test_client_portfolio_memberships.py +++ /dev/null @@ -1,34 +0,0 @@ -from .helpers import * - -class TestClientPortfolioMemberships(ClientTestCase): - def test_portfolio_memberships_get_portfolio_membership(self): - res = { - "data": { - "id": 1331, - "name": "Things to Buy" - } - } - responses.add(GET, 'http://app/portfolio_memberships/1331', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.portfolio_memberships.get_portfolio_membership('1331'), res['data']) - - def test_portfolio_memberships_get_portfolio_memberships_for_portfolio(self): - res = { - "data": [ - { - "id": 1331, - "name": "Things to Buy" - } - ] - } - responses.add(GET, 'http://app/portfolios/1331/portfolio_memberships', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.portfolio_memberships.get_portfolio_memberships_for_portfolio('1331'), res['data']) - - def test_portfolio_memberships_get_portfolio_memberships(self): - res = { - "data": [ - { "id": 1331, "name": "Things to buy" }, - { "id": 14641, "name": "Cat Stuff" } - ] - } - responses.add(GET, 'http://app/portfolio_memberships', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.portfolio_memberships.get_portfolio_memberships(), res['data']) diff --git a/tests/test_client_portfolios.py b/tests/test_client_portfolios.py deleted file mode 100644 index d9627413..00000000 --- a/tests/test_client_portfolios.py +++ /dev/null @@ -1,95 +0,0 @@ -from .helpers import * - -class TestClientPortfolios(ClientTestCase): - def test_portfolios_create_portfolio(self): - req = { - "data": { - "name": "Things to Buy", - "notes": "These are things we want to purchase.", - "workspace": 14916 - } - } - res = { - "data": { - "id": 1331, - "name": "Things to Buy", - "notes": "These are things we want to purchase." - } - } - responses.add(POST, 'http://app/portfolios', status=201, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.portfolios.create_portfolio(req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_portfolios_get_portfolio(self): - res = { - "data": { - "id": 1331, - "name": "Things to Buy", - "notes": "These are things we want to purchase." - } - } - responses.add(GET, 'http://app/portfolios/1331', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.portfolios.get_portfolio('1331'), res['data']) - - def test_portfolios_update_portfolio(self): - req = { - "data": { - "notes": "These are things we NEED to purchase." - } - } - res = { - "data": { - "id": 1331, - "name": "Things to Buy", - "notes": "These are things we NEED to purchase." - } - } - responses.add(PUT, 'http://app/portfolios/1331', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.portfolios.update_portfolio('1331', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_portfolios_delete_portfolio(self): - res = { "data": {} } - responses.add(DELETE, 'http://app/portfolios/1331', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.portfolios.delete_portfolio('1331'), res['data']) - - def test_portfolios_get_portfolios(self): - res = { - "data": [ - { "id": 1331, "name": "Things to buy" }, - { "id": 14641, "name": "Cat Stuff" } - ] - } - responses.add(GET, 'http://app/portfolios', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.portfolios.get_portfolios(), res['data']) - - def test_portfolios_add_custom_field_settings(self): - req = { - "data": { - "custom_field":124578, - "is_important": true - } - } - res = { - "data": {} - } - - responses.add(POST, 'http://app/portfolios/1331/addCustomFieldSetting', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.portfolios.add_custom_field_setting(1331, req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - - def test_portfolios_remove_custom_field_settings(self): - req = { - "data": { - "custom_field":124578, - } - } - res = { - "data": {} - } - - responses.add(POST, 'http://app/portfolios/1331/addCustomFieldSetting', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.portfolios.add_custom_field_setting('1331', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - diff --git a/tests/test_client_projects.py b/tests/test_client_projects.py deleted file mode 100644 index 7932e688..00000000 --- a/tests/test_client_projects.py +++ /dev/null @@ -1,104 +0,0 @@ -from .helpers import * - -class TestClientProjects(ClientTestCase): - def test_projects_create_project(self): - req = { - "data": { - "name": "Things to Buy", - "notes": "These are things we want to purchase.", - "workspace": 14916 - } - } - res = { - "data": { - "id": 1331, - "name": "Things to Buy", - "notes": "These are things we want to purchase." - } - } - responses.add(POST, 'http://app/projects', status=201, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.projects.create_project(req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_projects_get_project(self): - res = { - "data": { - "id": 1331, - "name": "Things to Buy", - "notes": "These are things we want to purchase." - } - } - responses.add(GET, 'http://app/projects/1331', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.projects.get_project('1331'), res['data']) - - def test_projects_update_project(self): - req = { - "data": { - "notes": "These are things we NEED to purchase." - } - } - res = { - "data": { - "id": 1331, - "name": "Things to Buy", - "notes": "These are things we NEED to purchase." - } - } - responses.add(PUT, 'http://app/projects/1331', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.projects.update_project('1331', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_projects_delete_project(self): - res = { "data": {} } - responses.add(DELETE, 'http://app/projects/1331', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.projects.delete_project('1331'), res['data']) - - def test_projects_get_projects_for_workspace(self): - res = { - "data": [ - { "id": 1331, "name": "Things to buy" }, - { "id": 14641, "name": "Cat Stuff" } - ] - } - responses.add(GET, 'http://app/workspaces/14916/projects', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.projects.get_projects_for_workspace('14916'), res['data']) - - def test_projects_get_projects(self): - res = { - "data": [ - { "id": 1331, "name": "Things to buy" }, - { "id": 14641, "name": "Cat Stuff" } - ] - } - responses.add(GET, 'http://app/projects', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.projects.get_projects(), res['data']) - - def test_projects_add_custom_field_setting_for_project(self): - req = { - "data": { - "custom_field":124578, - "is_important": true - } - } - res = { - "data": {} - } - - responses.add(POST, 'http://app/projects/1331/addCustomFieldSetting', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.projects.add_custom_field_setting_for_project('1331', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - - def test_projects_remove_custom_field_setting_for_project(self): - req = { - "data": { - "custom_field":124578, - } - } - res = { - "data": {} - } - - responses.add(POST, 'http://app/projects/1331/removeCustomFieldSetting', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.projects.remove_custom_field_setting_for_project('1331', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) diff --git a/tests/test_client_sections.py b/tests/test_client_sections.py deleted file mode 100644 index 1026cf19..00000000 --- a/tests/test_client_sections.py +++ /dev/null @@ -1,114 +0,0 @@ -import json - -import responses - -from .helpers import ClientTestCase, GET, DELETE, POST, PUT - - -class TestClientSections(ClientTestCase): - - def test_sections_create_section_for_project(self): - resp = { - "data": { - "id": 2001, - "name": "High Priority:", - "created_at": "2017-01-17T22:06:39.249Z", - "project": { - "id": 1331, - "name": "Things to buy" - } - } - } - - responses.add( - POST, 'http://app/projects/1331/sections', status=200, - body=json.dumps(resp), match_querystring=True) - self.assertEqual( - self.client.sections.create_section_for_project('1331'), resp['data']) - - def test_sections_get_sections_for_project(self): - resp = { - "data": [ - { - "id": 2001, - "name": "High Priority:" - }, - { - "id": 2002, - "name": "Low Priority:" - }, - ] - } - - responses.add( - GET, 'http://app/projects/1331/sections', status=200, - body=json.dumps(resp), match_querystring=True) - self.assertEqual( - self.client.sections.get_sections_for_project('1331'), resp['data']) - - def test_sections_get_section(self): - resp = { - "data": { - "id": 2001, - "name": "High Priority:", - "created_at": "2017-01-17T22:06:39.249Z", - "project": { - "id": 1331, - "name": "Things to buy" - } - } - } - - responses.add( - GET, 'http://app/sections/2001', status=200, - body=json.dumps(resp), match_querystring=True) - self.assertEqual( - self.client.sections.get_section('2001'), resp['data']) - - def test_sections_update_section(self): - req = { - "name": "High Priority, renamed:" - } - resp = { - "data": { - "id": 2001, - "name": "High Priority, renamed:", - "created_at": "2017-01-17T22:06:39.249Z", - "project": { - "id": 1331, - "name": "Things to buy" - } - } - } - - responses.add( - PUT, 'http://app/sections/2001', status=200, - body=json.dumps(resp), match_querystring=True) - self.assertEqual( - self.client.sections.update_section('2001', req), resp['data']) - - def test_sections_delete_section(self): - resp = { - "data": {} - } - - responses.add( - DELETE, 'http://app/sections/2001', status=200, - body=json.dumps(resp), match_querystring=True) - self.assertEqual( - self.client.sections.delete_section('2001'), resp['data']) - - def test_sections_insert_section_for_project(self): - resp = { - "data": { - "section": 2001, - "project": 1331, - "before_section": 1330 - } - } - - responses.add( - POST, 'http://app/projects/1331/sections/insert', status=200, - body=json.dumps(resp), match_querystring=True) - self.assertEqual( - self.client.sections.insert_section_for_project('1331'), resp['data']) diff --git a/tests/test_client_stories.py b/tests/test_client_stories.py deleted file mode 100644 index 8f37df53..00000000 --- a/tests/test_client_stories.py +++ /dev/null @@ -1,57 +0,0 @@ -from .helpers import * - -class TestClientStories(ClientTestCase): - - def test_stories_get_stories_for_task(self): - res = { - "data": [ - { - "created_at": "2011-12-21T23:23:01.259Z", - "created_by": { "id": 5678, "name": "Greg Sanchez" }, - "id": 2001, - "text": "added to Things To Buy", - "type": "system" - }, - { - "created_at": "2012-01-02T21:32:40.112Z", - "created_by": { "id": 1234, "name": "Tim Bizarro" }, - "id": 2002, - "text": "Again? Wow, we really go through this stuff fast.", - "type": "comment" - } - ] - } - responses.add(GET, 'http://app/tasks/1001/stories', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.stories.get_stories_for_task('1001'), res['data']) - - def test_stories_get_story(self): - res = { - "data": { - "created_at": "2012-02-22T02:06:58.147Z", - "created_by": { "id": 1123, "name": "Mittens" }, - "id": 2001, - "source": "web", - "target": { "id": 1234, "name": "Buy catnip" }, - "text": "Yes, please!", - "type": "comment" - } - } - responses.add(GET, 'http://app/stories/2001', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.stories.get_story('2001'), res['data']) - - def test_stories_create_story_for_task(self): - req = { "data": { "text": "This is a very nice comment." } } - res = { - "data": { - "created_at": "2011-12-21T23:23:01.259Z", - "created_by": { "id": 5678, "name": "Greg Sanchez" }, - "id": 2001, - "source": "api", - "target": { "id": 1001, "name": "Buy catnip" }, - "text": "This is a very nice comment.", - "type": "comment" - } - } - responses.add(POST, 'http://app/tasks/1001/stories', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.stories.create_story_for_task('1001', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) diff --git a/tests/test_client_tags.py b/tests/test_client_tags.py deleted file mode 100644 index 553fa960..00000000 --- a/tests/test_client_tags.py +++ /dev/null @@ -1,37 +0,0 @@ -from .helpers import * - -class TestClientTags(ClientTestCase): - def test_tags_create_tag(self): - req = { "data": { "name": "fluffy", "workspace": 14916 } } - res = { "data": { "id": 1771, "name": "fluffy" } } - responses.add(POST, 'http://app/tags', status=201, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tags.create_tag(req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_tags_get_tag(self): - res = { - "data": { - "id": 1331, - "name": "Things to Buy", - "notes": "These are things we want to purchase." - } - } - responses.add(GET, 'http://app/tags/1331', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tags.get_tag('1331'), res['data']) - - def test_tags_update_tag(self): - req = { "data": { "name": "Things to Sell" } } - res = { "data": { "id": 1331, "name": "Things to Sell" } } - responses.add(PUT, 'http://app/tags/1331', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tags.update_tag('1331', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_tags_get_tags_for_workspace(self): - res = { - "data": [ - { "id": 1331, "name": "Things to buy" }, - { "id": 14641, "name": "Cat Stuff" } - ] - } - responses.add(GET, 'http://app/workspaces/14916/tags', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tags.get_tags_for_workspace('14916'), res['data']) diff --git a/tests/test_client_tasks.py b/tests/test_client_tasks.py deleted file mode 100644 index 343b5653..00000000 --- a/tests/test_client_tasks.py +++ /dev/null @@ -1,239 +0,0 @@ -from .helpers import * - -class TestClientTasks(ClientTestCase): - - def test_tasks_create_task(self): - req = { - "data": { - "assignee": 1235, - "followers": [5678], - "name": "Hello, world.", - "notes": "How are you today?", - "workspace": 14916 - } - } - res = { - "data": { - "assignee": { "id": 1235, "name": "Tim Bizarro" }, - "assignee_status": "inbox", - "completed": false, - "completed_at": null, - "created_at": "2012-02-22T02:06:58.158Z", - "due_on": null, - "followers": [{ "id": 5678, "name": "Greg Sanchez" } ], - "id": 1001, - "modified_at": "2012-02-22T02:06:58.158Z", - "name": "Hello, world!", - "notes": "How are you today?", - "parent": null, - "projects": [{ "id": 14641, "name": "Cat Stuff" }], - "workspace": { "id": 14916, "name": "My Favorite Workspace" } - } - } - responses.add(POST, 'http://app/tasks', status=201, body=json.dumps(res), match_querystring=True) - - self.assertEqual(self.client.tasks.create_task(req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_tasks_get_task(self): - res = { - "data": { - "assignee": { "id": 1234, "name": "Tim Bizarro" }, - "created_at": "2012-02-22T02:06:58.158Z" - } - } - responses.add(GET, 'http://app/tasks/1001', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.get_task('1001'), res['data']) - - def test_tasks_get_tasks_for_project(self): - res = { - "data": [ - { "id": 2001, "name": "Catnip" }, - { "id": 2002, "name": "Kitty litter" } - ] - } - responses.add(GET, 'http://app/projects/1331/tasks', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.get_tasks_for_project('1331'), res['data']) - - def test_tasks_update_task(self): - req = { "data": { "assignee": "me" } } - res = { - "data": { - "assignee": { "id": 1234, "name": "Tim Bizarro" }, - "id": 1001 - } - } - responses.add(PUT, 'http://app/tasks/1001', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.update_task('1001', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_tasks_delete_task(self): - res = { "data": {} } - responses.add(DELETE, 'http://app/tasks/1001', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.delete_task('1001'), res['data']) - - def test_tasks_get_tasks(self): - res = { - "data": [ - { "id": 1248, "name": "Buy catnip" }, - { "id": 24816, "name": "Reflect on role of kittens in society" } - ] - } - responses.add(GET, 'http://app/tasks?workspace=14916&assignee=me', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.get_tasks({ 'workspace': 14916, 'assignee': 'me' }), res['data']) - - def test_tasks_add_subtask(self): - req = { - "data": { - "assignee": 1235, - "followers": [5678], - "name": "Tell Luke", - "notes": "He's going to be upset." - } - } - res = { - "data": { - "assignee": { "id": 1235, "name": "Darth Vader" }, - "assignee_status": "inbox", - "completed": false, - "completed_at": null, - "created_at": "2012-02-22T02:06:58.158Z", - "due_on": null, - "followers": [{ "id": 5678, "name": "Emperor Palpatine" } ], - "id": 1001, - "modified_at": "2012-02-22T02:06:58.158Z", - "name": "Tell Luke", - "notes": "He's going to be upset.", - "parent": { "id": 2272, "name": "Tell kids I am their father." }, - "projects": [], - "workspace": { "id": 14916, "name": "Star Wars" } - } - } - responses.add(POST, 'http://app/tasks/2272/subtasks', status=201, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.add_subtask('2272', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_tasks_subtasks(self): - res = { - "data": [ - { "id": 5005, "name": "Steal Underwear" }, - { "id": 6709, "name": "???" }, - { "id": 9812, "name": "Profit" } - ] - } - responses.add(GET, 'http://app/tasks/7331/subtasks', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.subtasks(7331), res['data']) - - def test_tasks_set_parent(self): - req = { "data": { "parent": 1331 } } - res = { - "data": { - "id": 2272, - "name": "Tell Luke", - "parent": [{ "id": 1331, "name": "Tell kids I am their father" }] - } - } - responses.add(POST, 'http://app/tasks/2272/setParent', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.set_parent('2272', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_tasks_projects(self): - res = { - "data": [ - { "id": 1331, "name": "Things To Buy" }, - { "id": 14641, "name": "Cat Stuff" } - ] - } - responses.add(GET, 'http://app/tasks/1001/projects', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.projects('1001'), res['data']) - - def test_tasks_add_project(self): - req = { "data": { "project": 14641 } } - res = { "data": {} } - responses.add(POST, 'http://app/tasks/1001/addProject', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.add_project('1001', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_tasks_remove_project(self): - req = { "data": { "project": 14641 } } - res = { "data": {} } - responses.add(POST, 'http://app/tasks/1001/removeProject', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.remove_project('1001', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_tasks_tags(self): - res = { - "data": [ - { "id": 1331, "name": "orange" }, - { "id": 1771, "name": "fluffy" } - ] - } - responses.add(GET, 'http://app/tasks/1001/tags', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.tags('1001'), res['data']) - - def test_tasks_1001_addTag(self): - req = { "data": { "tag": 1771 } } - res = { "data": {} } - responses.add(POST, 'http://app/tasks/1001/addTag', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.add_tag('1001', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_tasks_removeTag(self): - req = { "data": { "tag": 1771 } } - res = { "data": {} } - responses.add(POST, 'http://app/tasks/1001/removeTag', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.remove_tag('1001', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_tasks_add_followers(self): - req = { "data": { "followers": [1235] } } - res = { - "data": { - "followers": [{ "id": 1235, "name": "Darth Vader" }], - "id": 1001 - } - } - responses.add(POST, 'http://app/tasks/1001/addFollowers', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.add_followers('1001', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_tasks_remove_followers(self): - req = { "data": { "followers": [1235] } } - res = { "data": { "followers": [], "id": 1001 } } - responses.add(POST, 'http://app/tasks/1001/removeFollowers', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.remove_followers('1001', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) - - def test_tasks_get_tasks_for_tag(self): - res = { - "data": [ - { "id": 2001, "name": "Catnip" }, - { "id": 2002, "name": "Kitty litter" } - ] - } - responses.add(GET, 'http://app/tags/1331/tasks', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.get_tasks_for_tag('1331'), res['data']) - - def test_tasks_custom_field_data(self): - res = { - "data": { - "id": 1001, - "name": "Hello, world!", - "completed": false, - "custom_fields": [ - { - "id": 124578, - "name": "Priority", - "type": "enum", - "enum_value": { - "id": 789, - "name": "Low", - "enabled": true, - "color": "blue" - } - } - ] - } - } - responses.add(GET, 'http://app/tasks/1001', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.get_task('1001'), res['data']) diff --git a/tests/test_client_teams.py b/tests/test_client_teams.py deleted file mode 100644 index 7a6a2e0c..00000000 --- a/tests/test_client_teams.py +++ /dev/null @@ -1,13 +0,0 @@ -from .helpers import * - -class TestClientTeams(ClientTestCase): - - def test_teams_get_teams_for_workspace(self): - res = { - "data": [ - { "id": 5832, "name": "Atlanta Braves" }, - { "id": 15923, "name": "New York Yankees" } - ] - } - responses.add(GET, 'http://app/workspaces/13523/teams', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.teams.get_teams_for_workspace('13523'), res['data']) diff --git a/tests/test_client_user_task_lists.py b/tests/test_client_user_task_lists.py deleted file mode 100644 index 1576122d..00000000 --- a/tests/test_client_user_task_lists.py +++ /dev/null @@ -1,33 +0,0 @@ -from .helpers import * - -class TestClientUserTaskLists(ClientTestCase): - def test_user_task_lists_get_user_task_list(self): - res = { - "data": { - "id": 1331, - "name": "Things to Buy" - } - } - responses.add(GET, 'http://app/user_task_lists/1331', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.user_task_lists.get_user_task_list('1331'), res['data']) - - def test_user_task_lists_get_user_task_list_for_user(self): - res = { - "data": { - "id": 1331, - "name": "Things to Buy" - } - } - responses.add(GET, 'http://app/users/1331/user_task_list', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.user_task_lists.get_user_task_list_for_user('1331'), res['data']) - - def test_task_get_tasks_for_user_task_list(self): - res = { - "data": [ - { "id": 1331, "name": "Things to buy" }, - { "id": 14641, "name": "Cat Stuff" } - ] - } - responses.add(GET, 'http://app/user_task_lists/1335/tasks', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.tasks.get_tasks_for_user_task_list('1335'), res['data']) - diff --git a/tests/test_client_users.py b/tests/test_client_users.py deleted file mode 100644 index f905256b..00000000 --- a/tests/test_client_users.py +++ /dev/null @@ -1,42 +0,0 @@ -from .helpers import * - -class TestClientUsers(ClientTestCase): - - def test_users_me(self): - res = { - "data": { "email":"sanchez@...", "id": 999, "name":"Greg Sanchez" } - } - responses.add(GET, 'http://app/users/me', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.users.get_user('me'), res['data']) - - def test_users_get_user(self): - res = { - "data": { - "email": "gsanchez@example.com", - "id": 5678, - "name": "Greg Sanchez", - "workspaces": [{ "id": 1337, "name": "My Favorite Workspace" }] - } - } - responses.add(GET, 'http://app/users/5678', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.users.get_user('5678'), res['data']) - - def test_users_get_users(self): - res = { - "data": [ - { "email": "tbizarro@example.com", "id": 1234, "name": "Tim Bizarro" }, - { "email": "gsanchez@example.com", "id": 5678, "name": "Greg Sanchez" } - ] - } - # responses.add(GET, 'http://app/users?opt_fields=name,email', status=200, body=json.dumps(res), match_querystring=True) - responses.add(GET, 'http://app/users', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.users.get_users(), res['data']) - - def test_users_get_users_for_workspace(self): - res = { - "data": [ - { "id": 5678, "name": "Greg Sanchez" } - ] - } - responses.add(GET, 'http://app/workspaces/1337/users', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.users.get_users_for_workspace('1337'), res['data']) diff --git a/tests/test_client_webhooks.py b/tests/test_client_webhooks.py deleted file mode 100644 index 9efd5556..00000000 --- a/tests/test_client_webhooks.py +++ /dev/null @@ -1,38 +0,0 @@ -from .helpers import * - - -class TestClientWebhooks(ClientTestCase): - - def setUp(self): - ClientTestCase.setUp(self) - self.webhook_data = { - "id": 222, - "resource": { - "id": 111, - "name": "the resource" - }, - "target": "https://foo/123", - "active": true - } - - def test_webhooks_create_webhook(self): - req = { "resource": 111, "target": "https://foo/123" } - res = { "data": self.webhook_data } - responses.add(POST, 'http://app/webhooks', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.webhooks.create_webhook(req), self.webhook_data) - - def test_webhooks_get_webhooks(self): - req = { "workspace": 1337 } - res = { "data": [self.webhook_data] } - responses.add(GET, 'http://app/webhooks?workspace=1337', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.webhooks.get_webhooks(req), [self.webhook_data]) - - def test_webhooks_get_webhook(self): - res = { "data": self.webhook_data } - responses.add(GET, 'http://app/webhooks/222', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.webhooks.get_webhook('222'), self.webhook_data) - - def test_webhooks_delete_webhook(self): - res = { "data": {} } - responses.add(DELETE, 'http://app/webhooks/222', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.webhooks.delete_webhook('222'), {}) diff --git a/tests/test_client_workspaces.py b/tests/test_client_workspaces.py deleted file mode 100644 index 6226a242..00000000 --- a/tests/test_client_workspaces.py +++ /dev/null @@ -1,20 +0,0 @@ -from .helpers import * - -class TestClientWorkspaces(ClientTestCase): - - def test_workspaces_get_workspaces(self): - res = { "data": [{ "id": 1337, "name": "My Favorite Workspace" }]} - responses.add(GET, 'http://app/workspaces', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.workspaces.get_workspaces(), res['data']) - - def test_workspaces_get_workspace(self): - res = { "data": [{ "id": 1337, "name": "My Favorite Workspace" }]} - responses.add(GET, 'http://app/workspaces/222', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.workspaces.get_workspace('222'), res['data']) - - def test_workspaces_update_workspace(self): - req = { "data": { "name": "Everyone's Favorite Workspace" } } - res = { "data": { "id": 1337, "name": "Everyone's Favorite Workspace" } } - responses.add(PUT, 'http://app/workspaces/1337', status=200, body=json.dumps(res), match_querystring=True) - self.assertEqual(self.client.workspaces.update_workspace('1337', req['data']), res['data']) - self.assertEqual(json.loads(responses.calls[0].request.body), req) diff --git a/tests/test_errors.py b/tests/test_errors.py deleted file mode 100644 index 162ce08d..00000000 --- a/tests/test_errors.py +++ /dev/null @@ -1,24 +0,0 @@ -import json - -import responses - -from .helpers import asana, ClientTestCase - - -class TestErrors(ClientTestCase): - def test_premium_only_402(self): - resp_json = { - "errors": [ - { - "message": ( - "Custom Fields are not available for free " - "users or guests.") - } - ] - } - responses.add( - responses.GET, - 'http://app/workspaces/12345/custom_fields', status=402, - body=json.dumps(resp_json), match_querystring=True) - with self.assertRaises(asana.error.PremiumOnlyError): - self.client.custom_fields.get_custom_fields_for_workspace('12345') From 4df777b16b97cb85ccfe639c65aa248a666fa14d Mon Sep 17 00:00:00 2001 From: John Vu Date: Mon, 4 Dec 2023 13:12:46 -0800 Subject: [PATCH 2/2] Generate python v5 --- .swagger-codegen-ignore | 23 + .swagger-codegen/VERSION | 1 + README.md | 929 ++++++ asana/__init__.py | 55 + asana/api/__init__.py | 40 + asana/api/attachments_api.py | 633 ++++ asana/api/audit_log_api_api.py | 189 ++ asana/api/batch_api_api.py | 178 ++ asana/api/custom_field_settings_api.py | 325 ++ asana/api/custom_fields_api.py | 1176 +++++++ asana/api/events_api.py | 177 ++ asana/api/goal_relationships_api.py | 761 +++++ asana/api/goals_api.py | 1486 +++++++++ asana/api/jobs_api.py | 172 ++ asana/api/memberships_api.py | 589 ++++ asana/api/organization_exports_api.py | 314 ++ asana/api/portfolio_memberships_api.py | 466 +++ asana/api/portfolios_api.py | 1768 +++++++++++ asana/api/project_briefs_api.py | 604 ++++ asana/api/project_memberships_api.py | 320 ++ asana/api/project_statuses_api.py | 602 ++++ asana/api/project_templates_api.py | 743 +++++ asana/api/projects_api.py | 2796 +++++++++++++++++ asana/api/rules_api.py | 178 ++ asana/api/sections_api.py | 1030 +++++++ asana/api/status_updates_api.py | 602 ++++ asana/api/stories_api.py | 750 +++++ asana/api/tags_api.py | 1171 +++++++ asana/api/task_templates_api.py | 459 +++ asana/api/tasks_api.py | 3936 ++++++++++++++++++++++++ asana/api/team_memberships_api.py | 616 ++++ asana/api/teams_api.py | 1053 +++++++ asana/api/time_periods_api.py | 322 ++ asana/api/time_tracking_entries_api.py | 750 +++++ asana/api/typeahead_api.py | 187 ++ asana/api/user_task_lists_api.py | 317 ++ asana/api/users_api.py | 762 +++++ asana/api/webhooks_api.py | 746 +++++ asana/api/workspace_memberships_api.py | 466 +++ asana/api/workspaces_api.py | 753 +++++ asana/api_client.py | 626 ++++ asana/configuration.py | 260 ++ asana/pagination/__init__.py | 19 + asana/pagination/event_iterator.py | 38 + asana/pagination/page_iterator.py | 64 + asana/rest.py | 317 ++ docs/AttachmentsApi.md | 227 ++ docs/AttachmentsApi.yaml | 95 + docs/AuditLogAPIApi.md | 74 + docs/AuditLogAPIApi.yaml | 31 + docs/BatchAPIApi.md | 60 + docs/BatchAPIApi.yaml | 24 + docs/CustomFieldSettingsApi.md | 121 + docs/CustomFieldSettingsApi.yaml | 51 + docs/CustomFieldsApi.md | 433 +++ docs/CustomFieldsApi.yaml | 182 ++ docs/EventsApi.md | 62 + docs/EventsApi.yaml | 25 + docs/GoalRelationshipsApi.md | 277 ++ docs/GoalRelationshipsApi.yaml | 116 + docs/GoalsApi.md | 552 ++++ docs/GoalsApi.yaml | 234 ++ docs/JobsApi.md | 59 + docs/JobsApi.yaml | 23 + docs/MembershipsApi.md | 217 ++ docs/MembershipsApi.yaml | 90 + docs/OrganizationExportsApi.md | 111 + docs/OrganizationExportsApi.yaml | 45 + docs/PortfolioMembershipsApi.md | 179 ++ docs/PortfolioMembershipsApi.yaml | 76 + docs/PortfoliosApi.md | 642 ++++ docs/PortfoliosApi.yaml | 269 ++ docs/ProjectBriefsApi.md | 216 ++ docs/ProjectBriefsApi.yaml | 89 + docs/ProjectMembershipsApi.md | 118 + docs/ProjectMembershipsApi.yaml | 49 + docs/ProjectStatusesApi.md | 219 ++ docs/ProjectStatusesApi.yaml | 91 + docs/ProjectTemplatesApi.md | 278 ++ docs/ProjectTemplatesApi.yaml | 117 + docs/ProjectsApi.md | 1036 +++++++ docs/ProjectsApi.yaml | 440 +++ docs/RulesApi.md | 58 + docs/RulesApi.yaml | 22 + docs/SectionsApi.md | 377 +++ docs/SectionsApi.yaml | 158 + docs/StatusUpdatesApi.md | 223 ++ docs/StatusUpdatesApi.yaml | 93 + docs/StoriesApi.md | 273 ++ docs/StoriesApi.yaml | 114 + docs/TagsApi.md | 437 +++ docs/TagsApi.yaml | 185 ++ docs/TaskTemplatesApi.md | 170 + docs/TaskTemplatesApi.yaml | 71 + docs/TasksApi.md | 1528 +++++++++ docs/TasksApi.yaml | 661 ++++ docs/TeamMembershipsApi.md | 236 ++ docs/TeamMembershipsApi.yaml | 101 + docs/TeamsApi.md | 386 +++ docs/TeamsApi.yaml | 163 + docs/TimePeriodsApi.md | 120 + docs/TimePeriodsApi.yaml | 50 + docs/TimeTrackingEntriesApi.md | 273 ++ docs/TimeTrackingEntriesApi.yaml | 114 + docs/TypeaheadApi.md | 68 + docs/TypeaheadApi.yaml | 28 + docs/UserTaskListsApi.md | 113 + docs/UserTaskListsApi.yaml | 46 + docs/UsersApi.md | 289 ++ docs/UsersApi.yaml | 124 + docs/WebhooksApi.md | 273 ++ docs/WebhooksApi.yaml | 114 + docs/WorkspaceMembershipsApi.md | 175 ++ docs/WorkspaceMembershipsApi.yaml | 74 + docs/WorkspacesApi.md | 273 ++ docs/WorkspacesApi.yaml | 114 + requirements.txt | 5 + setup.py | 48 + test-requirements.txt | 5 + test/__init__.py | 1 + test/test_attachments_api.py | 61 + test/test_audit_log_api_api.py | 40 + test/test_batch_api_api.py | 40 + test/test_custom_field_settings_api.py | 47 + test/test_custom_fields_api.py | 89 + test/test_events_api.py | 40 + test/test_goal_relationships_api.py | 68 + test/test_goals_api.py | 103 + test/test_jobs_api.py | 40 + test/test_memberships_api.py | 61 + test/test_organization_exports_api.py | 47 + test/test_portfolio_memberships_api.py | 54 + test/test_portfolios_api.py | 117 + test/test_project_briefs_api.py | 61 + test/test_project_memberships_api.py | 47 + test/test_project_statuses_api.py | 61 + test/test_project_templates_api.py | 68 + test/test_projects_api.py | 166 + test/test_rules_api.py | 40 + test/test_sections_api.py | 82 + test/test_status_updates_api.py | 61 + test/test_stories_api.py | 68 + test/test_tags_api.py | 89 + test/test_task_templates_api.py | 54 + test/test_tasks_api.py | 215 ++ test/test_team_memberships_api.py | 61 + test/test_teams_api.py | 82 + test/test_time_periods_api.py | 47 + test/test_time_tracking_entries_api.py | 68 + test/test_typeahead_api.py | 40 + test/test_user_task_lists_api.py | 47 + test/test_users_api.py | 68 + test/test_webhooks_api.py | 68 + test/test_workspace_memberships_api.py | 54 + test/test_workspaces_api.py | 68 + tox.ini | 10 + 156 files changed, 46692 insertions(+) create mode 100644 .swagger-codegen-ignore create mode 100644 .swagger-codegen/VERSION create mode 100644 README.md create mode 100644 asana/__init__.py create mode 100644 asana/api/__init__.py create mode 100644 asana/api/attachments_api.py create mode 100644 asana/api/audit_log_api_api.py create mode 100644 asana/api/batch_api_api.py create mode 100644 asana/api/custom_field_settings_api.py create mode 100644 asana/api/custom_fields_api.py create mode 100644 asana/api/events_api.py create mode 100644 asana/api/goal_relationships_api.py create mode 100644 asana/api/goals_api.py create mode 100644 asana/api/jobs_api.py create mode 100644 asana/api/memberships_api.py create mode 100644 asana/api/organization_exports_api.py create mode 100644 asana/api/portfolio_memberships_api.py create mode 100644 asana/api/portfolios_api.py create mode 100644 asana/api/project_briefs_api.py create mode 100644 asana/api/project_memberships_api.py create mode 100644 asana/api/project_statuses_api.py create mode 100644 asana/api/project_templates_api.py create mode 100644 asana/api/projects_api.py create mode 100644 asana/api/rules_api.py create mode 100644 asana/api/sections_api.py create mode 100644 asana/api/status_updates_api.py create mode 100644 asana/api/stories_api.py create mode 100644 asana/api/tags_api.py create mode 100644 asana/api/task_templates_api.py create mode 100644 asana/api/tasks_api.py create mode 100644 asana/api/team_memberships_api.py create mode 100644 asana/api/teams_api.py create mode 100644 asana/api/time_periods_api.py create mode 100644 asana/api/time_tracking_entries_api.py create mode 100644 asana/api/typeahead_api.py create mode 100644 asana/api/user_task_lists_api.py create mode 100644 asana/api/users_api.py create mode 100644 asana/api/webhooks_api.py create mode 100644 asana/api/workspace_memberships_api.py create mode 100644 asana/api/workspaces_api.py create mode 100644 asana/api_client.py create mode 100644 asana/configuration.py create mode 100644 asana/pagination/__init__.py create mode 100644 asana/pagination/event_iterator.py create mode 100644 asana/pagination/page_iterator.py create mode 100644 asana/rest.py create mode 100644 docs/AttachmentsApi.md create mode 100644 docs/AttachmentsApi.yaml create mode 100644 docs/AuditLogAPIApi.md create mode 100644 docs/AuditLogAPIApi.yaml create mode 100644 docs/BatchAPIApi.md create mode 100644 docs/BatchAPIApi.yaml create mode 100644 docs/CustomFieldSettingsApi.md create mode 100644 docs/CustomFieldSettingsApi.yaml create mode 100644 docs/CustomFieldsApi.md create mode 100644 docs/CustomFieldsApi.yaml create mode 100644 docs/EventsApi.md create mode 100644 docs/EventsApi.yaml create mode 100644 docs/GoalRelationshipsApi.md create mode 100644 docs/GoalRelationshipsApi.yaml create mode 100644 docs/GoalsApi.md create mode 100644 docs/GoalsApi.yaml create mode 100644 docs/JobsApi.md create mode 100644 docs/JobsApi.yaml create mode 100644 docs/MembershipsApi.md create mode 100644 docs/MembershipsApi.yaml create mode 100644 docs/OrganizationExportsApi.md create mode 100644 docs/OrganizationExportsApi.yaml create mode 100644 docs/PortfolioMembershipsApi.md create mode 100644 docs/PortfolioMembershipsApi.yaml create mode 100644 docs/PortfoliosApi.md create mode 100644 docs/PortfoliosApi.yaml create mode 100644 docs/ProjectBriefsApi.md create mode 100644 docs/ProjectBriefsApi.yaml create mode 100644 docs/ProjectMembershipsApi.md create mode 100644 docs/ProjectMembershipsApi.yaml create mode 100644 docs/ProjectStatusesApi.md create mode 100644 docs/ProjectStatusesApi.yaml create mode 100644 docs/ProjectTemplatesApi.md create mode 100644 docs/ProjectTemplatesApi.yaml create mode 100644 docs/ProjectsApi.md create mode 100644 docs/ProjectsApi.yaml create mode 100644 docs/RulesApi.md create mode 100644 docs/RulesApi.yaml create mode 100644 docs/SectionsApi.md create mode 100644 docs/SectionsApi.yaml create mode 100644 docs/StatusUpdatesApi.md create mode 100644 docs/StatusUpdatesApi.yaml create mode 100644 docs/StoriesApi.md create mode 100644 docs/StoriesApi.yaml create mode 100644 docs/TagsApi.md create mode 100644 docs/TagsApi.yaml create mode 100644 docs/TaskTemplatesApi.md create mode 100644 docs/TaskTemplatesApi.yaml create mode 100644 docs/TasksApi.md create mode 100644 docs/TasksApi.yaml create mode 100644 docs/TeamMembershipsApi.md create mode 100644 docs/TeamMembershipsApi.yaml create mode 100644 docs/TeamsApi.md create mode 100644 docs/TeamsApi.yaml create mode 100644 docs/TimePeriodsApi.md create mode 100644 docs/TimePeriodsApi.yaml create mode 100644 docs/TimeTrackingEntriesApi.md create mode 100644 docs/TimeTrackingEntriesApi.yaml create mode 100644 docs/TypeaheadApi.md create mode 100644 docs/TypeaheadApi.yaml create mode 100644 docs/UserTaskListsApi.md create mode 100644 docs/UserTaskListsApi.yaml create mode 100644 docs/UsersApi.md create mode 100644 docs/UsersApi.yaml create mode 100644 docs/WebhooksApi.md create mode 100644 docs/WebhooksApi.yaml create mode 100644 docs/WorkspaceMembershipsApi.md create mode 100644 docs/WorkspaceMembershipsApi.yaml create mode 100644 docs/WorkspacesApi.md create mode 100644 docs/WorkspacesApi.yaml create mode 100644 requirements.txt create mode 100644 setup.py create mode 100644 test-requirements.txt create mode 100644 test/__init__.py create mode 100644 test/test_attachments_api.py create mode 100644 test/test_audit_log_api_api.py create mode 100644 test/test_batch_api_api.py create mode 100644 test/test_custom_field_settings_api.py create mode 100644 test/test_custom_fields_api.py create mode 100644 test/test_events_api.py create mode 100644 test/test_goal_relationships_api.py create mode 100644 test/test_goals_api.py create mode 100644 test/test_jobs_api.py create mode 100644 test/test_memberships_api.py create mode 100644 test/test_organization_exports_api.py create mode 100644 test/test_portfolio_memberships_api.py create mode 100644 test/test_portfolios_api.py create mode 100644 test/test_project_briefs_api.py create mode 100644 test/test_project_memberships_api.py create mode 100644 test/test_project_statuses_api.py create mode 100644 test/test_project_templates_api.py create mode 100644 test/test_projects_api.py create mode 100644 test/test_rules_api.py create mode 100644 test/test_sections_api.py create mode 100644 test/test_status_updates_api.py create mode 100644 test/test_stories_api.py create mode 100644 test/test_tags_api.py create mode 100644 test/test_task_templates_api.py create mode 100644 test/test_tasks_api.py create mode 100644 test/test_team_memberships_api.py create mode 100644 test/test_teams_api.py create mode 100644 test/test_time_periods_api.py create mode 100644 test/test_time_tracking_entries_api.py create mode 100644 test/test_typeahead_api.py create mode 100644 test/test_user_task_lists_api.py create mode 100644 test/test_users_api.py create mode 100644 test/test_webhooks_api.py create mode 100644 test/test_workspace_memberships_api.py create mode 100644 test/test_workspaces_api.py create mode 100644 tox.ini diff --git a/.swagger-codegen-ignore b/.swagger-codegen-ignore new file mode 100644 index 00000000..c5fa491b --- /dev/null +++ b/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION new file mode 100644 index 00000000..16176176 --- /dev/null +++ b/.swagger-codegen/VERSION @@ -0,0 +1 @@ +3.0.46 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..38f159a6 --- /dev/null +++ b/README.md @@ -0,0 +1,929 @@ +# asana [![GitHub release][release-image]]() [![PyPi Version][pypi-image]][pypi-url] + +> **Warning** +> Python client library version `>5.X.X` is currently in BETA and subject to change. Please use v3.2.X for stable / production environments `pip install asana==3.2.2`. If you have feedback on the new version, please your feedback [here](https://form.asana.com/?k=C4sELCq6hAUsoWEY0kJwAA&d=15793206719). + +> You can try out our new python beta by installing version [v5.0.0](https://github.com/Asana/python-asana/tree/v5.0.0) (`pip install asana==5.0.0`) + +- API version: 1.0 +- Package version: 5.0.0 + +## Requirements. + +Python 3.4+ + +## Installation & Usage +### pip install from [PyPI](https://pypi.org/project/asana/) + +```sh +pip install asana +``` + +Then import the package: +```python +import asana +``` + +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) + +Then import the package: +```python +import asana +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +user_gid = "me" +opts = {} + +try: + # Get a user + user = users_api_instance.get_user(user_gid, opts) + pprint(user) +except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) +``` + +### Example: GET, POST, PUT, DELETE on tasks + +#### GET - get multiple tasks +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +opts = { + 'limit': 50, + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", + 'assignee': "14641", + 'project': "321654", + 'section': "321654", + 'workspace': "321654", + 'completed_since': '2012-02-22T02:06:58.158Z', + 'modified_since': '2012-02-22T02:06:58.158Z', + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" +} + +try: + # Get multiple tasks + tasks = tasks_api_instance.get_tasks(opts) + for task in tasks: + pprint(task) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +#### POST - create a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = { + "data": { + "name": "New Task", + "projects": [""], + } +} +opts = {} + +try: + # Create a task + task = tasks_api_instance.create_task(body, opts) + pprint(task) +except ApiException as e: + print("Exception when calling TasksApi->create_task: %s\n" % e) +``` + +#### PUT - update a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = { + "data": { + "name": "Updated Task", + } +} +task_gid = "" +opts = {} + +try: + # Update a task + task = tasks_api_instance.update_task(body, task_gid, opts) + pprint(task) +except ApiException as e: + print("Exception when calling TasksApi->update_task: %s\n" % e) +``` + +#### DELETE - delete a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +task_gid = "" + +try: + # Delete a task + task = tasks_api_instance.delete_task(task_gid) + pprint(task) +except ApiException as e: + print("Exception when calling TasksApi->delete_task: %s\n" % e) +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://app.asana.com/api/1.0* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AttachmentsApi* | [**create_attachment_for_object**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/AttachmentsApi.md#create_attachment_for_object) | **POST** /attachments | Upload an attachment +*AttachmentsApi* | [**delete_attachment**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/AttachmentsApi.md#delete_attachment) | **DELETE** /attachments/{attachment_gid} | Delete an attachment +*AttachmentsApi* | [**get_attachment**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/AttachmentsApi.md#get_attachment) | **GET** /attachments/{attachment_gid} | Get an attachment +*AttachmentsApi* | [**get_attachments_for_object**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/AttachmentsApi.md#get_attachments_for_object) | **GET** /attachments | Get attachments from an object +*AuditLogAPIApi* | [**get_audit_log_events**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/AuditLogAPIApi.md#get_audit_log_events) | **GET** /workspaces/{workspace_gid}/audit_log_events | Get audit log events +*BatchAPIApi* | [**create_batch_request**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/BatchAPIApi.md#create_batch_request) | **POST** /batch | Submit parallel requests +*CustomFieldSettingsApi* | [**get_custom_field_settings_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldSettingsApi.md#get_custom_field_settings_for_portfolio) | **GET** /portfolios/{portfolio_gid}/custom_field_settings | Get a portfolio's custom fields +*CustomFieldSettingsApi* | [**get_custom_field_settings_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldSettingsApi.md#get_custom_field_settings_for_project) | **GET** /projects/{project_gid}/custom_field_settings | Get a project's custom fields +*CustomFieldsApi* | [**create_custom_field**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#create_custom_field) | **POST** /custom_fields | Create a custom field +*CustomFieldsApi* | [**create_enum_option_for_custom_field**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#create_enum_option_for_custom_field) | **POST** /custom_fields/{custom_field_gid}/enum_options | Create an enum option +*CustomFieldsApi* | [**delete_custom_field**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#delete_custom_field) | **DELETE** /custom_fields/{custom_field_gid} | Delete a custom field +*CustomFieldsApi* | [**get_custom_field**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#get_custom_field) | **GET** /custom_fields/{custom_field_gid} | Get a custom field +*CustomFieldsApi* | [**get_custom_fields_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#get_custom_fields_for_workspace) | **GET** /workspaces/{workspace_gid}/custom_fields | Get a workspace's custom fields +*CustomFieldsApi* | [**insert_enum_option_for_custom_field**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#insert_enum_option_for_custom_field) | **POST** /custom_fields/{custom_field_gid}/enum_options/insert | Reorder a custom field's enum +*CustomFieldsApi* | [**update_custom_field**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#update_custom_field) | **PUT** /custom_fields/{custom_field_gid} | Update a custom field +*CustomFieldsApi* | [**update_enum_option**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/CustomFieldsApi.md#update_enum_option) | **PUT** /enum_options/{enum_option_gid} | Update an enum option +*EventsApi* | [**get_events**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/EventsApi.md#get_events) | **GET** /events | Get events on a resource +*GoalRelationshipsApi* | [**add_supporting_relationship**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalRelationshipsApi.md#add_supporting_relationship) | **POST** /goals/{goal_gid}/addSupportingRelationship | Add a supporting goal relationship +*GoalRelationshipsApi* | [**get_goal_relationship**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalRelationshipsApi.md#get_goal_relationship) | **GET** /goal_relationships/{goal_relationship_gid} | Get a goal relationship +*GoalRelationshipsApi* | [**get_goal_relationships**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalRelationshipsApi.md#get_goal_relationships) | **GET** /goal_relationships | Get goal relationships +*GoalRelationshipsApi* | [**remove_supporting_relationship**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalRelationshipsApi.md#remove_supporting_relationship) | **POST** /goals/{goal_gid}/removeSupportingRelationship | Removes a supporting goal relationship +*GoalRelationshipsApi* | [**update_goal_relationship**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalRelationshipsApi.md#update_goal_relationship) | **PUT** /goal_relationships/{goal_relationship_gid} | Update a goal relationship +*GoalsApi* | [**add_followers**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#add_followers) | **POST** /goals/{goal_gid}/addFollowers | Add a collaborator to a goal +*GoalsApi* | [**create_goal**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#create_goal) | **POST** /goals | Create a goal +*GoalsApi* | [**create_goal_metric**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#create_goal_metric) | **POST** /goals/{goal_gid}/setMetric | Create a goal metric +*GoalsApi* | [**delete_goal**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#delete_goal) | **DELETE** /goals/{goal_gid} | Delete a goal +*GoalsApi* | [**get_goal**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#get_goal) | **GET** /goals/{goal_gid} | Get a goal +*GoalsApi* | [**get_goals**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#get_goals) | **GET** /goals | Get goals +*GoalsApi* | [**get_parent_goals_for_goal**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#get_parent_goals_for_goal) | **GET** /goals/{goal_gid}/parentGoals | Get parent goals from a goal +*GoalsApi* | [**remove_followers**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#remove_followers) | **POST** /goals/{goal_gid}/removeFollowers | Remove a collaborator from a goal +*GoalsApi* | [**update_goal**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#update_goal) | **PUT** /goals/{goal_gid} | Update a goal +*GoalsApi* | [**update_goal_metric**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/GoalsApi.md#update_goal_metric) | **POST** /goals/{goal_gid}/setMetricCurrentValue | Update a goal metric +*JobsApi* | [**get_job**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/JobsApi.md#get_job) | **GET** /jobs/{job_gid} | Get a job by id +*MembershipsApi* | [**create_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/MembershipsApi.md#create_membership) | **POST** /memberships | Create a membership +*MembershipsApi* | [**delete_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/MembershipsApi.md#delete_membership) | **DELETE** /memberships/{membership_gid} | Delete a membership +*MembershipsApi* | [**get_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/MembershipsApi.md#get_membership) | **GET** /memberships/{membership_gid} | Get a membership +*MembershipsApi* | [**get_memberships**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/MembershipsApi.md#get_memberships) | **GET** /memberships | Get multiple memberships +*OrganizationExportsApi* | [**create_organization_export**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/OrganizationExportsApi.md#create_organization_export) | **POST** /organization_exports | Create an organization export request +*OrganizationExportsApi* | [**get_organization_export**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/OrganizationExportsApi.md#get_organization_export) | **GET** /organization_exports/{organization_export_gid} | Get details on an org export request +*PortfolioMembershipsApi* | [**get_portfolio_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfolioMembershipsApi.md#get_portfolio_membership) | **GET** /portfolio_memberships/{portfolio_membership_gid} | Get a portfolio membership +*PortfolioMembershipsApi* | [**get_portfolio_memberships**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfolioMembershipsApi.md#get_portfolio_memberships) | **GET** /portfolio_memberships | Get multiple portfolio memberships +*PortfolioMembershipsApi* | [**get_portfolio_memberships_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfolioMembershipsApi.md#get_portfolio_memberships_for_portfolio) | **GET** /portfolios/{portfolio_gid}/portfolio_memberships | Get memberships from a portfolio +*PortfoliosApi* | [**add_custom_field_setting_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#add_custom_field_setting_for_portfolio) | **POST** /portfolios/{portfolio_gid}/addCustomFieldSetting | Add a custom field to a portfolio +*PortfoliosApi* | [**add_item_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#add_item_for_portfolio) | **POST** /portfolios/{portfolio_gid}/addItem | Add a portfolio item +*PortfoliosApi* | [**add_members_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#add_members_for_portfolio) | **POST** /portfolios/{portfolio_gid}/addMembers | Add users to a portfolio +*PortfoliosApi* | [**create_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#create_portfolio) | **POST** /portfolios | Create a portfolio +*PortfoliosApi* | [**delete_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#delete_portfolio) | **DELETE** /portfolios/{portfolio_gid} | Delete a portfolio +*PortfoliosApi* | [**get_items_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#get_items_for_portfolio) | **GET** /portfolios/{portfolio_gid}/items | Get portfolio items +*PortfoliosApi* | [**get_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#get_portfolio) | **GET** /portfolios/{portfolio_gid} | Get a portfolio +*PortfoliosApi* | [**get_portfolios**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#get_portfolios) | **GET** /portfolios | Get multiple portfolios +*PortfoliosApi* | [**remove_custom_field_setting_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#remove_custom_field_setting_for_portfolio) | **POST** /portfolios/{portfolio_gid}/removeCustomFieldSetting | Remove a custom field from a portfolio +*PortfoliosApi* | [**remove_item_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#remove_item_for_portfolio) | **POST** /portfolios/{portfolio_gid}/removeItem | Remove a portfolio item +*PortfoliosApi* | [**remove_members_for_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#remove_members_for_portfolio) | **POST** /portfolios/{portfolio_gid}/removeMembers | Remove users from a portfolio +*PortfoliosApi* | [**update_portfolio**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/PortfoliosApi.md#update_portfolio) | **PUT** /portfolios/{portfolio_gid} | Update a portfolio +*ProjectBriefsApi* | [**create_project_brief**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectBriefsApi.md#create_project_brief) | **POST** /projects/{project_gid}/project_briefs | Create a project brief +*ProjectBriefsApi* | [**delete_project_brief**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectBriefsApi.md#delete_project_brief) | **DELETE** /project_briefs/{project_brief_gid} | Delete a project brief +*ProjectBriefsApi* | [**get_project_brief**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectBriefsApi.md#get_project_brief) | **GET** /project_briefs/{project_brief_gid} | Get a project brief +*ProjectBriefsApi* | [**update_project_brief**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectBriefsApi.md#update_project_brief) | **PUT** /project_briefs/{project_brief_gid} | Update a project brief +*ProjectMembershipsApi* | [**get_project_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectMembershipsApi.md#get_project_membership) | **GET** /project_memberships/{project_membership_gid} | Get a project membership +*ProjectMembershipsApi* | [**get_project_memberships_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectMembershipsApi.md#get_project_memberships_for_project) | **GET** /projects/{project_gid}/project_memberships | Get memberships from a project +*ProjectStatusesApi* | [**create_project_status_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectStatusesApi.md#create_project_status_for_project) | **POST** /projects/{project_gid}/project_statuses | Create a project status +*ProjectStatusesApi* | [**delete_project_status**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectStatusesApi.md#delete_project_status) | **DELETE** /project_statuses/{project_status_gid} | Delete a project status +*ProjectStatusesApi* | [**get_project_status**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectStatusesApi.md#get_project_status) | **GET** /project_statuses/{project_status_gid} | Get a project status +*ProjectStatusesApi* | [**get_project_statuses_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectStatusesApi.md#get_project_statuses_for_project) | **GET** /projects/{project_gid}/project_statuses | Get statuses from a project +*ProjectTemplatesApi* | [**delete_project_template**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectTemplatesApi.md#delete_project_template) | **DELETE** /project_templates/{project_template_gid} | Delete a project template +*ProjectTemplatesApi* | [**get_project_template**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectTemplatesApi.md#get_project_template) | **GET** /project_templates/{project_template_gid} | Get a project template +*ProjectTemplatesApi* | [**get_project_templates**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectTemplatesApi.md#get_project_templates) | **GET** /project_templates | Get multiple project templates +*ProjectTemplatesApi* | [**get_project_templates_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectTemplatesApi.md#get_project_templates_for_team) | **GET** /teams/{team_gid}/project_templates | Get a team's project templates +*ProjectTemplatesApi* | [**instantiate_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectTemplatesApi.md#instantiate_project) | **POST** /project_templates/{project_template_gid}/instantiateProject | Instantiate a project from a project template +*ProjectsApi* | [**add_custom_field_setting_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#add_custom_field_setting_for_project) | **POST** /projects/{project_gid}/addCustomFieldSetting | Add a custom field to a project +*ProjectsApi* | [**add_followers_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#add_followers_for_project) | **POST** /projects/{project_gid}/addFollowers | Add followers to a project +*ProjectsApi* | [**add_members_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#add_members_for_project) | **POST** /projects/{project_gid}/addMembers | Add users to a project +*ProjectsApi* | [**create_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#create_project) | **POST** /projects | Create a project +*ProjectsApi* | [**create_project_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#create_project_for_team) | **POST** /teams/{team_gid}/projects | Create a project in a team +*ProjectsApi* | [**create_project_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#create_project_for_workspace) | **POST** /workspaces/{workspace_gid}/projects | Create a project in a workspace +*ProjectsApi* | [**delete_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#delete_project) | **DELETE** /projects/{project_gid} | Delete a project +*ProjectsApi* | [**duplicate_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#duplicate_project) | **POST** /projects/{project_gid}/duplicate | Duplicate a project +*ProjectsApi* | [**get_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_project) | **GET** /projects/{project_gid} | Get a project +*ProjectsApi* | [**get_projects**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_projects) | **GET** /projects | Get multiple projects +*ProjectsApi* | [**get_projects_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_projects_for_task) | **GET** /tasks/{task_gid}/projects | Get projects a task is in +*ProjectsApi* | [**get_projects_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_projects_for_team) | **GET** /teams/{team_gid}/projects | Get a team's projects +*ProjectsApi* | [**get_projects_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_projects_for_workspace) | **GET** /workspaces/{workspace_gid}/projects | Get all projects in a workspace +*ProjectsApi* | [**get_task_counts_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_task_counts_for_project) | **GET** /projects/{project_gid}/task_counts | Get task count of a project +*ProjectsApi* | [**project_save_as_template**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#project_save_as_template) | **POST** /projects/{project_gid}/saveAsTemplate | Create a project template from a project +*ProjectsApi* | [**remove_custom_field_setting_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#remove_custom_field_setting_for_project) | **POST** /projects/{project_gid}/removeCustomFieldSetting | Remove a custom field from a project +*ProjectsApi* | [**remove_followers_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#remove_followers_for_project) | **POST** /projects/{project_gid}/removeFollowers | Remove followers from a project +*ProjectsApi* | [**remove_members_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#remove_members_for_project) | **POST** /projects/{project_gid}/removeMembers | Remove users from a project +*ProjectsApi* | [**update_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#update_project) | **PUT** /projects/{project_gid} | Update a project +*RulesApi* | [**trigger_rule**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/RulesApi.md#trigger_rule) | **POST** /rule_triggers/{rule_trigger_gid}/run | Trigger a rule +*SectionsApi* | [**add_task_for_section**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#add_task_for_section) | **POST** /sections/{section_gid}/addTask | Add task to section +*SectionsApi* | [**create_section_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#create_section_for_project) | **POST** /projects/{project_gid}/sections | Create a section in a project +*SectionsApi* | [**delete_section**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#delete_section) | **DELETE** /sections/{section_gid} | Delete a section +*SectionsApi* | [**get_section**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#get_section) | **GET** /sections/{section_gid} | Get a section +*SectionsApi* | [**get_sections_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#get_sections_for_project) | **GET** /projects/{project_gid}/sections | Get sections in a project +*SectionsApi* | [**insert_section_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#insert_section_for_project) | **POST** /projects/{project_gid}/sections/insert | Move or Insert sections +*SectionsApi* | [**update_section**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/SectionsApi.md#update_section) | **PUT** /sections/{section_gid} | Update a section +*StatusUpdatesApi* | [**create_status_for_object**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StatusUpdatesApi.md#create_status_for_object) | **POST** /status_updates | Create a status update +*StatusUpdatesApi* | [**delete_status**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StatusUpdatesApi.md#delete_status) | **DELETE** /status_updates/{status_update_gid} | Delete a status update +*StatusUpdatesApi* | [**get_status**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StatusUpdatesApi.md#get_status) | **GET** /status_updates/{status_update_gid} | Get a status update +*StatusUpdatesApi* | [**get_statuses_for_object**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StatusUpdatesApi.md#get_statuses_for_object) | **GET** /status_updates | Get status updates from an object +*StoriesApi* | [**create_story_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StoriesApi.md#create_story_for_task) | **POST** /tasks/{task_gid}/stories | Create a story on a task +*StoriesApi* | [**delete_story**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StoriesApi.md#delete_story) | **DELETE** /stories/{story_gid} | Delete a story +*StoriesApi* | [**get_stories_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StoriesApi.md#get_stories_for_task) | **GET** /tasks/{task_gid}/stories | Get stories from a task +*StoriesApi* | [**get_story**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StoriesApi.md#get_story) | **GET** /stories/{story_gid} | Get a story +*StoriesApi* | [**update_story**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/StoriesApi.md#update_story) | **PUT** /stories/{story_gid} | Update a story +*TagsApi* | [**create_tag**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#create_tag) | **POST** /tags | Create a tag +*TagsApi* | [**create_tag_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#create_tag_for_workspace) | **POST** /workspaces/{workspace_gid}/tags | Create a tag in a workspace +*TagsApi* | [**delete_tag**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#delete_tag) | **DELETE** /tags/{tag_gid} | Delete a tag +*TagsApi* | [**get_tag**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#get_tag) | **GET** /tags/{tag_gid} | Get a tag +*TagsApi* | [**get_tags**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#get_tags) | **GET** /tags | Get multiple tags +*TagsApi* | [**get_tags_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#get_tags_for_task) | **GET** /tasks/{task_gid}/tags | Get a task's tags +*TagsApi* | [**get_tags_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#get_tags_for_workspace) | **GET** /workspaces/{workspace_gid}/tags | Get tags in a workspace +*TagsApi* | [**update_tag**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TagsApi.md#update_tag) | **PUT** /tags/{tag_gid} | Update a tag +*TaskTemplatesApi* | [**get_task_template**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TaskTemplatesApi.md#get_task_template) | **GET** /task_templates/{task_template_gid} | Get a task template +*TaskTemplatesApi* | [**get_task_templates**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TaskTemplatesApi.md#get_task_templates) | **GET** /task_templates | Get multiple task templates +*TaskTemplatesApi* | [**instantiate_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TaskTemplatesApi.md#instantiate_task) | **POST** /task_templates/{task_template_gid}/instantiateTask | Instantiate a task from a task template +*TasksApi* | [**add_dependencies_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#add_dependencies_for_task) | **POST** /tasks/{task_gid}/addDependencies | Set dependencies for a task +*TasksApi* | [**add_dependents_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#add_dependents_for_task) | **POST** /tasks/{task_gid}/addDependents | Set dependents for a task +*TasksApi* | [**add_followers_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#add_followers_for_task) | **POST** /tasks/{task_gid}/addFollowers | Add followers to a task +*TasksApi* | [**add_project_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#add_project_for_task) | **POST** /tasks/{task_gid}/addProject | Add a project to a task +*TasksApi* | [**add_tag_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#add_tag_for_task) | **POST** /tasks/{task_gid}/addTag | Add a tag to a task +*TasksApi* | [**create_subtask_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#create_subtask_for_task) | **POST** /tasks/{task_gid}/subtasks | Create a subtask +*TasksApi* | [**create_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#create_task) | **POST** /tasks | Create a task +*TasksApi* | [**delete_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#delete_task) | **DELETE** /tasks/{task_gid} | Delete a task +*TasksApi* | [**duplicate_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#duplicate_task) | **POST** /tasks/{task_gid}/duplicate | Duplicate a task +*TasksApi* | [**get_dependencies_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_dependencies_for_task) | **GET** /tasks/{task_gid}/dependencies | Get dependencies from a task +*TasksApi* | [**get_dependents_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_dependents_for_task) | **GET** /tasks/{task_gid}/dependents | Get dependents from a task +*TasksApi* | [**get_subtasks_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_subtasks_for_task) | **GET** /tasks/{task_gid}/subtasks | Get subtasks from a task +*TasksApi* | [**get_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_task) | **GET** /tasks/{task_gid} | Get a task +*TasksApi* | [**get_tasks**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_tasks) | **GET** /tasks | Get multiple tasks +*TasksApi* | [**get_tasks_for_project**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_tasks_for_project) | **GET** /projects/{project_gid}/tasks | Get tasks from a project +*TasksApi* | [**get_tasks_for_section**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_tasks_for_section) | **GET** /sections/{section_gid}/tasks | Get tasks from a section +*TasksApi* | [**get_tasks_for_tag**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_tasks_for_tag) | **GET** /tags/{tag_gid}/tasks | Get tasks from a tag +*TasksApi* | [**get_tasks_for_user_task_list**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_tasks_for_user_task_list) | **GET** /user_task_lists/{user_task_list_gid}/tasks | Get tasks from a user task list +*TasksApi* | [**remove_dependencies_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#remove_dependencies_for_task) | **POST** /tasks/{task_gid}/removeDependencies | Unlink dependencies from a task +*TasksApi* | [**remove_dependents_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#remove_dependents_for_task) | **POST** /tasks/{task_gid}/removeDependents | Unlink dependents from a task +*TasksApi* | [**remove_follower_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#remove_follower_for_task) | **POST** /tasks/{task_gid}/removeFollowers | Remove followers from a task +*TasksApi* | [**remove_project_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#remove_project_for_task) | **POST** /tasks/{task_gid}/removeProject | Remove a project from a task +*TasksApi* | [**remove_tag_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#remove_tag_for_task) | **POST** /tasks/{task_gid}/removeTag | Remove a tag from a task +*TasksApi* | [**search_tasks_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#search_tasks_for_workspace) | **GET** /workspaces/{workspace_gid}/tasks/search | Search tasks in a workspace +*TasksApi* | [**set_parent_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#set_parent_for_task) | **POST** /tasks/{task_gid}/setParent | Set the parent of a task +*TasksApi* | [**update_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#update_task) | **PUT** /tasks/{task_gid} | Update a task +*TeamMembershipsApi* | [**get_team_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamMembershipsApi.md#get_team_membership) | **GET** /team_memberships/{team_membership_gid} | Get a team membership +*TeamMembershipsApi* | [**get_team_memberships**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamMembershipsApi.md#get_team_memberships) | **GET** /team_memberships | Get team memberships +*TeamMembershipsApi* | [**get_team_memberships_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamMembershipsApi.md#get_team_memberships_for_team) | **GET** /teams/{team_gid}/team_memberships | Get memberships from a team +*TeamMembershipsApi* | [**get_team_memberships_for_user**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamMembershipsApi.md#get_team_memberships_for_user) | **GET** /users/{user_gid}/team_memberships | Get memberships from a user +*TeamsApi* | [**add_user_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#add_user_for_team) | **POST** /teams/{team_gid}/addUser | Add a user to a team +*TeamsApi* | [**create_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#create_team) | **POST** /teams | Create a team +*TeamsApi* | [**get_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#get_team) | **GET** /teams/{team_gid} | Get a team +*TeamsApi* | [**get_teams_for_user**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#get_teams_for_user) | **GET** /users/{user_gid}/teams | Get teams for a user +*TeamsApi* | [**get_teams_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#get_teams_for_workspace) | **GET** /workspaces/{workspace_gid}/teams | Get teams in a workspace +*TeamsApi* | [**remove_user_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#remove_user_for_team) | **POST** /teams/{team_gid}/removeUser | Remove a user from a team +*TeamsApi* | [**update_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TeamsApi.md#update_team) | **PUT** /teams/{team_gid} | Update a team +*TimePeriodsApi* | [**get_time_period**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimePeriodsApi.md#get_time_period) | **GET** /time_periods/{time_period_gid} | Get a time period +*TimePeriodsApi* | [**get_time_periods**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimePeriodsApi.md#get_time_periods) | **GET** /time_periods | Get time periods +*TimeTrackingEntriesApi* | [**create_time_tracking_entry**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimeTrackingEntriesApi.md#create_time_tracking_entry) | **POST** /tasks/{task_gid}/time_tracking_entries | Create a time tracking entry +*TimeTrackingEntriesApi* | [**delete_time_tracking_entry**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimeTrackingEntriesApi.md#delete_time_tracking_entry) | **DELETE** /time_tracking_entries/{time_tracking_entry_gid} | Delete a time tracking entry +*TimeTrackingEntriesApi* | [**get_time_tracking_entries_for_task**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimeTrackingEntriesApi.md#get_time_tracking_entries_for_task) | **GET** /tasks/{task_gid}/time_tracking_entries | Get time tracking entries for a task +*TimeTrackingEntriesApi* | [**get_time_tracking_entry**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimeTrackingEntriesApi.md#get_time_tracking_entry) | **GET** /time_tracking_entries/{time_tracking_entry_gid} | Get a time tracking entry +*TimeTrackingEntriesApi* | [**update_time_tracking_entry**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TimeTrackingEntriesApi.md#update_time_tracking_entry) | **PUT** /time_tracking_entries/{time_tracking_entry_gid} | Update a time tracking entry +*TypeaheadApi* | [**typeahead_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TypeaheadApi.md#typeahead_for_workspace) | **GET** /workspaces/{workspace_gid}/typeahead | Get objects via typeahead +*UserTaskListsApi* | [**get_user_task_list**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UserTaskListsApi.md#get_user_task_list) | **GET** /user_task_lists/{user_task_list_gid} | Get a user task list +*UserTaskListsApi* | [**get_user_task_list_for_user**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UserTaskListsApi.md#get_user_task_list_for_user) | **GET** /users/{user_gid}/user_task_list | Get a user's task list +*UsersApi* | [**get_favorites_for_user**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UsersApi.md#get_favorites_for_user) | **GET** /users/{user_gid}/favorites | Get a user's favorites +*UsersApi* | [**get_user**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UsersApi.md#get_user) | **GET** /users/{user_gid} | Get a user +*UsersApi* | [**get_users**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UsersApi.md#get_users) | **GET** /users | Get multiple users +*UsersApi* | [**get_users_for_team**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UsersApi.md#get_users_for_team) | **GET** /teams/{team_gid}/users | Get users in a team +*UsersApi* | [**get_users_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/UsersApi.md#get_users_for_workspace) | **GET** /workspaces/{workspace_gid}/users | Get users in a workspace or organization +*WebhooksApi* | [**create_webhook**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WebhooksApi.md#create_webhook) | **POST** /webhooks | Establish a webhook +*WebhooksApi* | [**delete_webhook**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WebhooksApi.md#delete_webhook) | **DELETE** /webhooks/{webhook_gid} | Delete a webhook +*WebhooksApi* | [**get_webhook**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WebhooksApi.md#get_webhook) | **GET** /webhooks/{webhook_gid} | Get a webhook +*WebhooksApi* | [**get_webhooks**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WebhooksApi.md#get_webhooks) | **GET** /webhooks | Get multiple webhooks +*WebhooksApi* | [**update_webhook**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WebhooksApi.md#update_webhook) | **PUT** /webhooks/{webhook_gid} | Update a webhook +*WorkspaceMembershipsApi* | [**get_workspace_membership**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspaceMembershipsApi.md#get_workspace_membership) | **GET** /workspace_memberships/{workspace_membership_gid} | Get a workspace membership +*WorkspaceMembershipsApi* | [**get_workspace_memberships_for_user**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspaceMembershipsApi.md#get_workspace_memberships_for_user) | **GET** /users/{user_gid}/workspace_memberships | Get workspace memberships for a user +*WorkspaceMembershipsApi* | [**get_workspace_memberships_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspaceMembershipsApi.md#get_workspace_memberships_for_workspace) | **GET** /workspaces/{workspace_gid}/workspace_memberships | Get the workspace memberships for a workspace +*WorkspacesApi* | [**add_user_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspacesApi.md#add_user_for_workspace) | **POST** /workspaces/{workspace_gid}/addUser | Add a user to a workspace or organization +*WorkspacesApi* | [**get_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspacesApi.md#get_workspace) | **GET** /workspaces/{workspace_gid} | Get a workspace +*WorkspacesApi* | [**get_workspaces**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspacesApi.md#get_workspaces) | **GET** /workspaces | Get multiple workspaces +*WorkspacesApi* | [**remove_user_for_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspacesApi.md#remove_user_for_workspace) | **POST** /workspaces/{workspace_gid}/removeUser | Remove a user from a workspace or organization +*WorkspacesApi* | [**update_workspace**](https://github.com/Asana/python-asana/blob/v5.0.0/docs/WorkspacesApi.md#update_workspace) | **PUT** /workspaces/{workspace_gid} | Update a workspace + +## Accessing repsonse data + +### Example: Accessing task data +```python +. +. +. +try: + task = tasks_api_instance.get_task(task_gid, opts) + task_name = task['name'] + task_notes = task['notes'] +except ApiException as e: + . + . + . +``` + +## Accessing response status code and headers + +In the scenario you want to access the response headers or the status code along with the response data you can +provide the `_return_http_data_only` parameter argument in the request method and set the value to `False` + +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +user_gid = 'me' # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +opts = {} + +try: + # Get a user - Add asana-enable in the request + (api_response, status, headers) = users_api_instance.get_user(user_gid, opts, _return_http_data_only=False) # returns a tuple: (response, status, headers) + pprint(api_response) + pprint(status) + pprint(headers) +except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) +``` + +## Adding deprecation flag: "asana-enable" or "asana-disable" header + +### On the client +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# Add asana-enable header for the client +api_client.default_headers['asana-enable'] = 'string_ids' +``` + +OR + +### On the request +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +user_gid = 'me' # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +opts = {} + +try: + # Get a user - Add asana-enable in the request + api_response = users_api_instance.get_user(user_gid, opts, header_params={'asana-enable': 'string_ids'}) + pprint(api_response) +except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) +``` + +## Async requests with multithreading + +This client library uses multithreading to make async requests. To make async requests you can pass in `async_req=True` in the method call. + +NOTE: +- This feature disables our auto-pagination feature +- You will want to add logic to handle the Asana API rate limits + +The code belows is an example of how to make 15 async create task calls. It does not handle the Asana API rate limits. +You will have to implement your own solution for API rate limits based on your tier. + +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +tasks_api_instance = asana.TasksApi(api_client) +threads = [] +for i in range(1, 15+1): + body = { + "data": { + "name": f"Task: {i}", + "projects": [""] + } + } + opts = {} + threads.append(tasks_api_instance.create_task(body, opts, async_req=True)) + +for thread in threads: + try: + pprint(thread.get()) + except ApiException as e: + print("Exception when calling TasksApi->create_task: %s\n" % e) +``` + +## Pagination + +The pagination feature is enabled by default. This means two things: + +1: Endpoints that return a single response (EX: [get_task](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_task) ([Get a task](https://developers.asana.com/reference/gettask)), [get_project](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_project) ([Get a project](https://developers.asana.com/reference/getproject)), etc...) +will return a response with the `"data"` key abstracted from the response. + +Instead of returning: +```python +{ + "data": { + "gid": "123", + "actual_time_minutes": null, + "assignee": null, + ... + "workspace": { + "gid": "1234567", + "name": "user@example.com", + "resource_type": "workspace" + } + } +} +``` + +It returns: +```python +{ + "gid": "123", + "actual_time_minutes": null, + "assignee": null, + ... + "workspace": { + "gid": "1234567", + "name": "user@example.com", + "resource_type": "workspace" + } +} +``` + +2: Endpoints that return an array of resources (EX: [get_tasks](https://github.com/Asana/python-asana/blob/v5.0.0/docs/TasksApi.md#get_tasks) ([Get multiple tasks](https://developers.asana.com/reference/gettasks)), [get_projects](https://github.com/Asana/python-asana/blob/v5.0.0/docs/ProjectsApi.md#get_projects) ([Get multiple projects](https://developers.asana.com/reference/getprojects)), etc...) +will return a generator object ([PageIterator.items](https://github.com/Asana/python-asana/blob/v5.0.0/asana/paget_iterator.py)) that you can use to iterate through each result. + +Example usage 1: +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +tasks_api_instance = asana.TasksApi(api_client) +opts = {"project": ""} + +try: + tasks = tasks_api_instance.get_tasks(opts) + for task in tasks: + pprint(task) + +except Exception as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +Example response: +```python +{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + . + . + . +``` + +Example usage 2: +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +tasks_api_instance = asana.TasksApi(api_client) +opts = {"project": ""} + +try: + tasks = tasks_api_instance.get_tasks(opts) + pprint(list(tasks)) + +except Exception as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +Example response: +```python +[{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + . + . + .] +``` + +### Ending pagination early + +In the scenario where you want to end the pagination early, you can specify an `item_limit` in the method call. This will stop the iterator from going past that limit. + +**Example Scenario:** You have 1000 tasks in a project and are only interested in the first 2 tasks. Instead of letting the pagination code continue to run to get all those 1000 tasks you can specify that you only want the first X results with `item_limit`. + +**Without `item_limit` - The for loop will continue to run until it runs out of tasks:** + +```python + ... + tasks = tasks_api_instance.get_tasks(opts) + for task in tasks: + pprint(task) + ... +``` + +**Sample response:** + +```python +{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + . + . + . + <1000th_TASK> +``` + +**With `item_limit` - the for loop will stop at the `item_limit` you specified:** +```python + ... + tasks = tasks_api_instance.get_tasks(opts, item_limit=2) + for task in tasks: + pprint(task) + ... +``` + +**Sample response:** + +```python +{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, +{'gid': '456', + 'name': 'Task 2', + 'resource_subtype': 'default_task', + 'resource_type': 'task'} +``` + +Alternatively, if you are iterating over the generator object in a for loop, you can also just break out of the loop. + +**EX:** +```python +... +opts = {'project': ""} + +try: + count = 0 + tasks = tasks_api_instance.get_tasks(opts) + for task in tasks: + if count == 2: + break + pprint(task) + count += 1 + ... +``` + +**Sample response:** + +```python +{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + {'gid': '456', + 'name': 'Task 2', + 'resource_subtype': 'default_task', + 'resource_type': 'task'} +``` + +### Disabling default pagination behaviour + +If you do not want to use the default pagination behaviour there are two ways to disbale it. + +1: Per request - Disable pagination behavior for a single request - pass in `full_payload=True` in the method request +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +tasks_api_instance = asana.TasksApi(api_client) +opts = {"project": "", "limit": 2} + +try: + tasks = tasks_api_instance.get_tasks(opts, full_payload=True) + pprint(tasks) +except Exception as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +Sample response: +```python +{'data': [{'gid': '123', + 'name': 'Task 1', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}, + {'gid': '456', + 'name': 'Task 2', + 'resource_subtype': 'default_task', + 'resource_type': 'task'}], + 'next_page': {'offset': 'eyJ0...', + 'path': '/tasks?project=789&limit=2&offset=eyJ0...', + 'uri': 'https://app.asana.com/api/1.0/tasks?project=789&limit=2&offset=eyJ0...'}} +``` + +2: Globally - Disable pagination behavior for all requests - Set `return_page_iterator` to False +```python +... +configuration = asana.Configuration() +configuration.access_token = '' +configuration.return_page_iterator = False +api_client = asana.ApiClient(configuration) +... +``` + +## Documentation for Using the `call_api` method + +Use this to make HTTP calls when the endpoint does not exist in the current library version or has bugs + +### Example: GET, POST, PUT, DELETE on tasks + +#### GET - get a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +try: + # GET - get a task + api_response = api_client.call_api( + "/tasks/{task_gid}", + "GET", + path_params={"task_gid": ""}, + query_params={}, + header_params={"Accept": "application/json; charset=utf-8"}, + body=None, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +#### GET - get multiple tasks -> with opt_fields +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +try: + # GET - get multiple tasks + api_response = api_client.call_api( + "/tasks", + "GET", + path_params={}, + query_params={ + "project": "", + "opt_fields": "name,notes,projects", + }, + header_params={"Accept": "application/json; charset=utf-8"}, + body=None, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +#### POST - create a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +try: + # POST - create a task + api_response = api_client.call_api( + "/tasks", + "POST", + path_params={}, + query_params={}, + header_params={ + "Accept": "application/json; charset=utf-8", + "Content-Type": "application/json; charset=utf-8", + }, + body={ + "data": { + "name": "New Task", + "projects": [""], + } + }, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +#### PUT - update a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +try: + # PUT - update a task + api_response = api_client.call_api( + "/tasks/{task_gid}", + "PUT", + path_params={"task_gid": ""}, + query_params={}, + header_params={ + "Accept": "application/json; charset=utf-8", + "Content-Type": "application/json; charset=utf-8", + }, + body={ + "data": { + "name": "Updated Task", + } + }, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +#### DELETE - delete a task +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +try: + # DELETE - delete a task + api_response = api_client.call_api( + "/tasks/{task_gid}", + "DELETE", + path_params={"task_gid": ""}, + query_params={}, + header_params={"Accept": "application/json; charset=utf-8"}, + body=None, + post_params=[], + files={}, + response_type=object, # You can specify one of the following types: float, bool, bytes, str, object + auth_settings=["token"], + async_req=None, + _return_http_data_only=True, + _preload_content=True, + _request_timeout=None, + collection_formats={}, + ) + pprint(api_response) +except ApiException as e: + print("Exception: %s\n" % e) +``` + +[release-image]: https://img.shields.io/github/release/asana/python-asana.svg + +[pypi-image]: https://img.shields.io/pypi/v/asana.svg?style=flat-square +[pypi-url]: https://pypi.python.org/pypi/asana/ diff --git a/asana/__init__.py b/asana/__init__.py new file mode 100644 index 00000000..c083de38 --- /dev/null +++ b/asana/__init__.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +# import apis into sdk package +from asana.api.attachments_api import AttachmentsApi +from asana.api.audit_log_api_api import AuditLogAPIApi +from asana.api.batch_api_api import BatchAPIApi +from asana.api.custom_field_settings_api import CustomFieldSettingsApi +from asana.api.custom_fields_api import CustomFieldsApi +from asana.api.events_api import EventsApi +from asana.api.goal_relationships_api import GoalRelationshipsApi +from asana.api.goals_api import GoalsApi +from asana.api.jobs_api import JobsApi +from asana.api.memberships_api import MembershipsApi +from asana.api.organization_exports_api import OrganizationExportsApi +from asana.api.portfolio_memberships_api import PortfolioMembershipsApi +from asana.api.portfolios_api import PortfoliosApi +from asana.api.project_briefs_api import ProjectBriefsApi +from asana.api.project_memberships_api import ProjectMembershipsApi +from asana.api.project_statuses_api import ProjectStatusesApi +from asana.api.project_templates_api import ProjectTemplatesApi +from asana.api.projects_api import ProjectsApi +from asana.api.rules_api import RulesApi +from asana.api.sections_api import SectionsApi +from asana.api.status_updates_api import StatusUpdatesApi +from asana.api.stories_api import StoriesApi +from asana.api.tags_api import TagsApi +from asana.api.task_templates_api import TaskTemplatesApi +from asana.api.tasks_api import TasksApi +from asana.api.team_memberships_api import TeamMembershipsApi +from asana.api.teams_api import TeamsApi +from asana.api.time_periods_api import TimePeriodsApi +from asana.api.time_tracking_entries_api import TimeTrackingEntriesApi +from asana.api.typeahead_api import TypeaheadApi +from asana.api.user_task_lists_api import UserTaskListsApi +from asana.api.users_api import UsersApi +from asana.api.webhooks_api import WebhooksApi +from asana.api.workspace_memberships_api import WorkspaceMembershipsApi +from asana.api.workspaces_api import WorkspacesApi +# import ApiClient +from asana.api_client import ApiClient +from asana.configuration import Configuration diff --git a/asana/api/__init__.py b/asana/api/__init__.py new file mode 100644 index 00000000..df32f318 --- /dev/null +++ b/asana/api/__init__.py @@ -0,0 +1,40 @@ +from __future__ import absolute_import + +# flake8: noqa + +# import apis into api package +from asana.api.attachments_api import AttachmentsApi +from asana.api.audit_log_api_api import AuditLogAPIApi +from asana.api.batch_api_api import BatchAPIApi +from asana.api.custom_field_settings_api import CustomFieldSettingsApi +from asana.api.custom_fields_api import CustomFieldsApi +from asana.api.events_api import EventsApi +from asana.api.goal_relationships_api import GoalRelationshipsApi +from asana.api.goals_api import GoalsApi +from asana.api.jobs_api import JobsApi +from asana.api.memberships_api import MembershipsApi +from asana.api.organization_exports_api import OrganizationExportsApi +from asana.api.portfolio_memberships_api import PortfolioMembershipsApi +from asana.api.portfolios_api import PortfoliosApi +from asana.api.project_briefs_api import ProjectBriefsApi +from asana.api.project_memberships_api import ProjectMembershipsApi +from asana.api.project_statuses_api import ProjectStatusesApi +from asana.api.project_templates_api import ProjectTemplatesApi +from asana.api.projects_api import ProjectsApi +from asana.api.rules_api import RulesApi +from asana.api.sections_api import SectionsApi +from asana.api.status_updates_api import StatusUpdatesApi +from asana.api.stories_api import StoriesApi +from asana.api.tags_api import TagsApi +from asana.api.task_templates_api import TaskTemplatesApi +from asana.api.tasks_api import TasksApi +from asana.api.team_memberships_api import TeamMembershipsApi +from asana.api.teams_api import TeamsApi +from asana.api.time_periods_api import TimePeriodsApi +from asana.api.time_tracking_entries_api import TimeTrackingEntriesApi +from asana.api.typeahead_api import TypeaheadApi +from asana.api.user_task_lists_api import UserTaskListsApi +from asana.api.users_api import UsersApi +from asana.api.webhooks_api import WebhooksApi +from asana.api.workspace_memberships_api import WorkspaceMembershipsApi +from asana.api.workspaces_api import WorkspacesApi diff --git a/asana/api/attachments_api.py b/asana/api/attachments_api.py new file mode 100644 index 00000000..64724e1d --- /dev/null +++ b/asana/api/attachments_api.py @@ -0,0 +1,633 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class AttachmentsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_attachment_for_object(self, opts, **kwargs): # noqa: E501 + """Upload an attachment # noqa: E501 + + Upload an attachment. This method uploads an attachment on an object and returns the compact record for the created attachment object. This is possible by either: - Providing the URL of the external resource being attached, or - Downloading the file content first and then uploading it as any other attachment. Note that it is not possible to attach files from third party services such as Dropbox, Box, Vimeo & Google Drive via the API The 100MB size limit on attachments in Asana is enforced on this endpoint. This endpoint expects a multipart/form-data encoded request containing the full contents of the file to be uploaded. Requests made should follow the HTTP/1.1 specification that line terminators are of the form `CRLF` or `\\r\\n` outlined [here](http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01#Basic-Rules) in order for the server to reliably and properly handle the request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_attachment_for_object(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_subtype: + :param str file: + :param str parent: + :param str url: + :param str name: + :param bool connect_to_app: + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AttachmentResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_attachment_for_object_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.create_attachment_for_object_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def create_attachment_for_object_with_http_info(self, opts, **kwargs): # noqa: E501 + """Upload an attachment # noqa: E501 + + Upload an attachment. This method uploads an attachment on an object and returns the compact record for the created attachment object. This is possible by either: - Providing the URL of the external resource being attached, or - Downloading the file content first and then uploading it as any other attachment. Note that it is not possible to attach files from third party services such as Dropbox, Box, Vimeo & Google Drive via the API The 100MB size limit on attachments in Asana is enforced on this endpoint. This endpoint expects a multipart/form-data encoded request containing the full contents of the file to be uploaded. Requests made should follow the HTTP/1.1 specification that line terminators are of the form `CRLF` or `\\r\\n` outlined [here](http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01#Basic-Rules) in order for the server to reliably and properly handle the request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_attachment_for_object_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_subtype: + :param str file: + :param str parent: + :param str url: + :param str name: + :param bool connect_to_app: + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AttachmentResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_attachment_for_object" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + if 'resource_subtype' in opts: + form_params.append(('resource_subtype', opts['resource_subtype'])) # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('resource_subtype') + if 'file' in opts: + local_var_files['file'] = opts['file'] # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('file') + if 'parent' in opts: + form_params.append(('parent', opts['parent'])) # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('parent') + if 'url' in opts: + form_params.append(('url', opts['url'])) # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('url') + if 'name' in opts: + form_params.append(('name', opts['name'])) # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('name') + if 'connect_to_app' in opts: + form_params.append(('connect_to_app', opts['connect_to_app'])) # noqa: E501 + + # Because form params and query params are both provided in the opts method parameter we need to remove the form params from the query params + query_params.pop('connect_to_app') + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/attachments', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/attachments', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/attachments', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_attachment(self, attachment_gid, **kwargs): # noqa: E501 + """Delete an attachment # noqa: E501 + + Deletes a specific, existing attachment. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_attachment(attachment_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str attachment_gid: Globally unique identifier for the attachment. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_attachment_with_http_info(attachment_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_attachment_with_http_info(attachment_gid, **kwargs) # noqa: E501 + return data + + def delete_attachment_with_http_info(self, attachment_gid, **kwargs): # noqa: E501 + """Delete an attachment # noqa: E501 + + Deletes a specific, existing attachment. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_attachment_with_http_info(attachment_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str attachment_gid: Globally unique identifier for the attachment. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_attachment" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'attachment_gid' is set + if (attachment_gid is None): + raise ValueError("Missing the required parameter `attachment_gid` when calling `delete_attachment`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['attachment_gid'] = attachment_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/attachments/{attachment_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/attachments/{attachment_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/attachments/{attachment_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_attachment(self, attachment_gid, opts, **kwargs): # noqa: E501 + """Get an attachment # noqa: E501 + + Get the full record for a single attachment. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attachment(attachment_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str attachment_gid: Globally unique identifier for the attachment. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AttachmentResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_attachment_with_http_info(attachment_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_attachment_with_http_info(attachment_gid, opts, **kwargs) # noqa: E501 + return data + + def get_attachment_with_http_info(self, attachment_gid, opts, **kwargs): # noqa: E501 + """Get an attachment # noqa: E501 + + Get the full record for a single attachment. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attachment_with_http_info(attachment_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str attachment_gid: Globally unique identifier for the attachment. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AttachmentResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_attachment" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'attachment_gid' is set + if (attachment_gid is None): + raise ValueError("Missing the required parameter `attachment_gid` when calling `get_attachment`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['attachment_gid'] = attachment_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/attachments/{attachment_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/attachments/{attachment_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/attachments/{attachment_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_attachments_for_object(self, parent, opts, **kwargs): # noqa: E501 + """Get attachments from an object # noqa: E501 + + Returns the compact records for all attachments on the object. There are three possible `parent` values for this request: `project`, `project_brief`, and `task`. For a project, an attachment refers to a file uploaded to the \"Key resources\" section in the project Overview. For a project brief, an attachment refers to inline files in the project brief itself. For a task, an attachment refers to a file directly associated to that task. Note that within the Asana app, inline images in the task description do not appear in the index of image thumbnails nor as stories in the task. However, requests made to `GET /attachments` for a task will return all of the images in the task, including inline images. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attachments_for_object(parent, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str parent: Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AttachmentResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_attachments_for_object_with_http_info(parent, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_attachments_for_object_with_http_info(parent, opts, **kwargs) # noqa: E501 + return data + + def get_attachments_for_object_with_http_info(self, parent, opts, **kwargs): # noqa: E501 + """Get attachments from an object # noqa: E501 + + Returns the compact records for all attachments on the object. There are three possible `parent` values for this request: `project`, `project_brief`, and `task`. For a project, an attachment refers to a file uploaded to the \"Key resources\" section in the project Overview. For a project brief, an attachment refers to inline files in the project brief itself. For a task, an attachment refers to a file directly associated to that task. Note that within the Asana app, inline images in the task description do not appear in the index of image thumbnails nor as stories in the task. However, requests made to `GET /attachments` for a task will return all of the images in the task, including inline images. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attachments_for_object_with_http_info(parent, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str parent: Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AttachmentResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_attachments_for_object" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'parent' is set + if (parent is None): + raise ValueError("Missing the required parameter `parent` when calling `get_attachments_for_object`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['parent'] = parent + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/attachments', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/attachments', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/attachments', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/audit_log_api_api.py b/asana/api/audit_log_api_api.py new file mode 100644 index 00000000..39d001e1 --- /dev/null +++ b/asana/api/audit_log_api_api.py @@ -0,0 +1,189 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class AuditLogAPIApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_audit_log_events(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get audit log events # noqa: E501 + + Retrieve the audit log events that have been captured in your domain. This endpoint will return a list of [AuditLogEvent](/reference/audit-log-api) objects, sorted by creation time in ascending order. Note that the Audit Log API captures events from October 8th, 2021 and later. Queries for events before this date will not return results. There are a number of query parameters (below) that can be used to filter the set of [AuditLogEvent](/reference/audit-log-api) objects that are returned in the response. Any combination of query parameters is valid. When no filters are provided, all of the events that have been captured in your domain will match. The list of events will always be [paginated](/docs/pagination). The default limit is 1000 events. The next set of events can be retrieved using the `offset` from the previous response. If there are no events that match the provided filters in your domain, the endpoint will return `null` for the `next_page` field. Querying again with the same filters may return new events if they were captured after the last request. Once a response includes a `next_page` with an `offset`, subsequent requests can be made with the latest `offset` to poll for new events that match the provided filters. *Note: If the filters you provided match events in your domain and `next_page` is present in the response, we will continue to send `next_page` on subsequent requests even when there are no more events that match the filters. This was put in place so that you can implement an audit log stream that will return future events that match these filters. If you are not interested in future events that match the filters you have defined, you can rely on checking empty `data` response for the end of current events that match your filters.* When no `offset` is provided, the response will begin with the oldest events that match the provided filters. It is important to note that [AuditLogEvent](/reference/audit-log-api) objects will be permanently deleted from our systems after 90 days. If you wish to keep a permanent record of these events, we recommend using a SIEM tool to ingest and store these logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_log_events(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param datetime start_at: Filter to events created after this time (inclusive). + :param datetime end_at: Filter to events created before this time (exclusive). + :param str event_type: Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values. + :param str actor_type: Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded. + :param str actor_gid: Filter to events triggered by the actor with this ID. + :param str resource_gid: Filter to events with this resource ID. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :return: AuditLogEventArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_audit_log_events_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_log_events_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_audit_log_events_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get audit log events # noqa: E501 + + Retrieve the audit log events that have been captured in your domain. This endpoint will return a list of [AuditLogEvent](/reference/audit-log-api) objects, sorted by creation time in ascending order. Note that the Audit Log API captures events from October 8th, 2021 and later. Queries for events before this date will not return results. There are a number of query parameters (below) that can be used to filter the set of [AuditLogEvent](/reference/audit-log-api) objects that are returned in the response. Any combination of query parameters is valid. When no filters are provided, all of the events that have been captured in your domain will match. The list of events will always be [paginated](/docs/pagination). The default limit is 1000 events. The next set of events can be retrieved using the `offset` from the previous response. If there are no events that match the provided filters in your domain, the endpoint will return `null` for the `next_page` field. Querying again with the same filters may return new events if they were captured after the last request. Once a response includes a `next_page` with an `offset`, subsequent requests can be made with the latest `offset` to poll for new events that match the provided filters. *Note: If the filters you provided match events in your domain and `next_page` is present in the response, we will continue to send `next_page` on subsequent requests even when there are no more events that match the filters. This was put in place so that you can implement an audit log stream that will return future events that match these filters. If you are not interested in future events that match the filters you have defined, you can rely on checking empty `data` response for the end of current events that match your filters.* When no `offset` is provided, the response will begin with the oldest events that match the provided filters. It is important to note that [AuditLogEvent](/reference/audit-log-api) objects will be permanently deleted from our systems after 90 days. If you wish to keep a permanent record of these events, we recommend using a SIEM tool to ingest and store these logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_log_events_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param datetime start_at: Filter to events created after this time (inclusive). + :param datetime end_at: Filter to events created before this time (exclusive). + :param str event_type: Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values. + :param str actor_type: Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded. + :param str actor_gid: Filter to events triggered by the actor with this ID. + :param str resource_gid: Filter to events with this resource ID. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :return: AuditLogEventArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_audit_log_events" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_audit_log_events`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/audit_log_events', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/audit_log_events', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/audit_log_events', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/batch_api_api.py b/asana/api/batch_api_api.py new file mode 100644 index 00000000..23b34e9f --- /dev/null +++ b/asana/api/batch_api_api.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class BatchAPIApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_batch_request(self, body, opts, **kwargs): # noqa: E501 + """Submit parallel requests # noqa: E501 + + Make multiple requests in parallel to Asana's API. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_batch_request(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The requests to batch together via the Batch API. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: BatchResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_batch_request_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_batch_request_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_batch_request_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Submit parallel requests # noqa: E501 + + Make multiple requests in parallel to Asana's API. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_batch_request_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The requests to batch together via the Batch API. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: BatchResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_batch_request" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_batch_request`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/batch', + "method": 'POST', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/custom_field_settings_api.py b/asana/api/custom_field_settings_api.py new file mode 100644 index 00000000..9c0d15b9 --- /dev/null +++ b/asana/api/custom_field_settings_api.py @@ -0,0 +1,325 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class CustomFieldSettingsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_custom_field_settings_for_portfolio(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get a portfolio's custom fields # noqa: E501 + + Returns a list of all of the custom fields settings on a portfolio, in compact form. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_field_settings_for_portfolio(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldSettingResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_custom_field_settings_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_custom_field_settings_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def get_custom_field_settings_for_portfolio_with_http_info(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get a portfolio's custom fields # noqa: E501 + + Returns a list of all of the custom fields settings on a portfolio, in compact form. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_field_settings_for_portfolio_with_http_info(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldSettingResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_custom_field_settings_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `get_custom_field_settings_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/custom_field_settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/portfolios/{portfolio_gid}/custom_field_settings', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/custom_field_settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_custom_field_settings_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get a project's custom fields # noqa: E501 + + Returns a list of all of the custom fields settings on a project, in compact form. Note that, as in all queries to collections which return compact representation, `opt_fields` can be used to include more data than is returned in the compact representation. See the [documentation for input/output options](https://developers.asana.com/docs/inputoutput-options) for more information. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_field_settings_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldSettingResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_custom_field_settings_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_custom_field_settings_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_custom_field_settings_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get a project's custom fields # noqa: E501 + + Returns a list of all of the custom fields settings on a project, in compact form. Note that, as in all queries to collections which return compact representation, `opt_fields` can be used to include more data than is returned in the compact representation. See the [documentation for input/output options](https://developers.asana.com/docs/inputoutput-options) for more information. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_field_settings_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldSettingResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_custom_field_settings_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_custom_field_settings_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/custom_field_settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/projects/{project_gid}/custom_field_settings', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/projects/{project_gid}/custom_field_settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/custom_fields_api.py b/asana/api/custom_fields_api.py new file mode 100644 index 00000000..b811964a --- /dev/null +++ b/asana/api/custom_fields_api.py @@ -0,0 +1,1176 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class CustomFieldsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_custom_field(self, body, opts, **kwargs): # noqa: E501 + """Create a custom field # noqa: E501 + + Creates a new custom field in a workspace. Every custom field is required to be created in a specific workspace, and this workspace cannot be changed once set. A custom field’s name must be unique within a workspace and not conflict with names of existing task properties such as `Due Date` or `Assignee`. A custom field’s type must be one of `text`, `enum`, `multi_enum`, `number`, `date`, or `people`. Returns the full record of the newly created custom field. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_custom_field(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The custom field object to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_custom_field_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_custom_field_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_custom_field_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a custom field # noqa: E501 + + Creates a new custom field in a workspace. Every custom field is required to be created in a specific workspace, and this workspace cannot be changed once set. A custom field’s name must be unique within a workspace and not conflict with names of existing task properties such as `Due Date` or `Assignee`. A custom field’s type must be one of `text`, `enum`, `multi_enum`, `number`, `date`, or `people`. Returns the full record of the newly created custom field. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_custom_field_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The custom field object to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_custom_field" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_custom_field`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/custom_fields', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/custom_fields', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/custom_fields', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_enum_option_for_custom_field(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Create an enum option # noqa: E501 + + Creates an enum option and adds it to this custom field’s list of enum options. A custom field can have at most 500 enum options (including disabled options). By default new enum options are inserted at the end of a custom field’s list. Locked custom fields can only have enum options added by the user who locked the field. Returns the full record of the newly created enum option. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_enum_option_for_custom_field(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param dict body: The enum option object to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EnumOptionData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_enum_option_for_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_enum_option_for_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + return data + + def create_enum_option_for_custom_field_with_http_info(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Create an enum option # noqa: E501 + + Creates an enum option and adds it to this custom field’s list of enum options. A custom field can have at most 500 enum options (including disabled options). By default new enum options are inserted at the end of a custom field’s list. Locked custom fields can only have enum options added by the user who locked the field. Returns the full record of the newly created enum option. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_enum_option_for_custom_field_with_http_info(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param dict body: The enum option object to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EnumOptionData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_enum_option_for_custom_field" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'custom_field_gid' is set + if (custom_field_gid is None): + raise ValueError("Missing the required parameter `custom_field_gid` when calling `create_enum_option_for_custom_field`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['custom_field_gid'] = custom_field_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}/enum_options', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/custom_fields/{custom_field_gid}/enum_options', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}/enum_options', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_custom_field(self, custom_field_gid, **kwargs): # noqa: E501 + """Delete a custom field # noqa: E501 + + A specific, existing custom field can be deleted by making a DELETE request on the URL for that custom field. Locked custom fields can only be deleted by the user who locked the field. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_custom_field(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_custom_field_with_http_info(custom_field_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_custom_field_with_http_info(custom_field_gid, **kwargs) # noqa: E501 + return data + + def delete_custom_field_with_http_info(self, custom_field_gid, **kwargs): # noqa: E501 + """Delete a custom field # noqa: E501 + + A specific, existing custom field can be deleted by making a DELETE request on the URL for that custom field. Locked custom fields can only be deleted by the user who locked the field. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_custom_field_with_http_info(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_custom_field" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'custom_field_gid' is set + if (custom_field_gid is None): + raise ValueError("Missing the required parameter `custom_field_gid` when calling `delete_custom_field`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['custom_field_gid'] = custom_field_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_custom_field(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Get a custom field # noqa: E501 + + Get the complete definition of a custom field’s metadata. Since custom fields can be defined for one of a number of types, and these types have different data and behaviors, there are fields that are relevant to a particular type. For instance, as noted above, enum_options is only relevant for the enum type and defines the set of choices that the enum could represent. The examples below show some of these type-specific custom field definitions. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_field(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + return data + + def get_custom_field_with_http_info(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Get a custom field # noqa: E501 + + Get the complete definition of a custom field’s metadata. Since custom fields can be defined for one of a number of types, and these types have different data and behaviors, there are fields that are relevant to a particular type. For instance, as noted above, enum_options is only relevant for the enum type and defines the set of choices that the enum could represent. The examples below show some of these type-specific custom field definitions. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_field_with_http_info(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_custom_field" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'custom_field_gid' is set + if (custom_field_gid is None): + raise ValueError("Missing the required parameter `custom_field_gid` when calling `get_custom_field`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['custom_field_gid'] = custom_field_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_custom_fields_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get a workspace's custom fields # noqa: E501 + + Returns a list of the compact representation of all of the custom fields in a workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_fields_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_custom_fields_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_custom_fields_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_custom_fields_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get a workspace's custom fields # noqa: E501 + + Returns a list of the compact representation of all of the custom fields in a workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_fields_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_custom_fields_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_custom_fields_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/custom_fields', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/custom_fields', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/custom_fields', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 insert_enum_option_for_custom_field(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Reorder a custom field's enum # noqa: E501 + + Moves a particular enum option to be either before or after another specified enum option in the custom field. Locked custom fields can only be reordered by the user who locked the field. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.insert_enum_option_for_custom_field(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param dict body: The enum option object to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EnumOptionData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.insert_enum_option_for_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.insert_enum_option_for_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + return data + + def insert_enum_option_for_custom_field_with_http_info(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Reorder a custom field's enum # noqa: E501 + + Moves a particular enum option to be either before or after another specified enum option in the custom field. Locked custom fields can only be reordered by the user who locked the field. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.insert_enum_option_for_custom_field_with_http_info(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param dict body: The enum option object to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EnumOptionData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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 insert_enum_option_for_custom_field" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'custom_field_gid' is set + if (custom_field_gid is None): + raise ValueError("Missing the required parameter `custom_field_gid` when calling `insert_enum_option_for_custom_field`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['custom_field_gid'] = custom_field_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}/enum_options/insert', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/custom_fields/{custom_field_gid}/enum_options/insert', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}/enum_options/insert', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_custom_field(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Update a custom field # noqa: E501 + + A specific, existing custom field can be updated by making a PUT request on the URL for that custom field. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the custom field. A custom field’s `type` cannot be updated. An enum custom field’s `enum_options` cannot be updated with this endpoint. Instead see “Work With Enum Options” for information on how to update `enum_options`. Locked custom fields can only be updated by the user who locked the field. Returns the complete updated custom field record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_custom_field(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param dict body: The custom field object with all updated properties. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_custom_field_with_http_info(custom_field_gid, opts, **kwargs) # noqa: E501 + return data + + def update_custom_field_with_http_info(self, custom_field_gid, opts, **kwargs): # noqa: E501 + """Update a custom field # noqa: E501 + + A specific, existing custom field can be updated by making a PUT request on the URL for that custom field. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the custom field. A custom field’s `type` cannot be updated. An enum custom field’s `enum_options` cannot be updated with this endpoint. Instead see “Work With Enum Options” for information on how to update `enum_options`. Locked custom fields can only be updated by the user who locked the field. Returns the complete updated custom field record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_custom_field_with_http_info(custom_field_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str custom_field_gid: Globally unique identifier for the custom field. (required) + :param dict body: The custom field object with all updated properties. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: CustomFieldResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_custom_field" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'custom_field_gid' is set + if (custom_field_gid is None): + raise ValueError("Missing the required parameter `custom_field_gid` when calling `update_custom_field`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['custom_field_gid'] = custom_field_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/custom_fields/{custom_field_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_enum_option(self, enum_option_gid, opts, **kwargs): # noqa: E501 + """Update an enum option # noqa: E501 + + Updates an existing enum option. Enum custom fields require at least one enabled enum option. Locked custom fields can only be updated by the user who locked the field. Returns the full record of the updated enum option. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_enum_option(enum_option_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str enum_option_gid: Globally unique identifier for the enum option. (required) + :param dict body: The enum option object to update + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EnumOptionData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_enum_option_with_http_info(enum_option_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_enum_option_with_http_info(enum_option_gid, opts, **kwargs) # noqa: E501 + return data + + def update_enum_option_with_http_info(self, enum_option_gid, opts, **kwargs): # noqa: E501 + """Update an enum option # noqa: E501 + + Updates an existing enum option. Enum custom fields require at least one enabled enum option. Locked custom fields can only be updated by the user who locked the field. Returns the full record of the updated enum option. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_enum_option_with_http_info(enum_option_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str enum_option_gid: Globally unique identifier for the enum option. (required) + :param dict body: The enum option object to update + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EnumOptionData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_enum_option" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'enum_option_gid' is set + if (enum_option_gid is None): + raise ValueError("Missing the required parameter `enum_option_gid` when calling `update_enum_option`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['enum_option_gid'] = enum_option_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/enum_options/{enum_option_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/enum_options/{enum_option_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/enum_options/{enum_option_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/events_api.py b/asana/api/events_api.py new file mode 100644 index 00000000..c03fbfd0 --- /dev/null +++ b/asana/api/events_api.py @@ -0,0 +1,177 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class EventsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_events(self, resource, opts, **kwargs): # noqa: E501 + """Get events on a resource # noqa: E501 + + Returns the full record for all events that have occurred since the sync token was created. A `GET` request to the endpoint `/[path_to_resource]/events` can be made in lieu of including the resource ID in the data for the request. Asana limits a single sync token to 100 events. If more than 100 events exist for a given resource, `has_more: true` will be returned in the response, indicating that there are more events to pull. *Note: The resource returned will be the resource that triggered the event. This may be different from the one that the events were requested for. For example, a subscription to a project will contain events for tasks contained within the project.* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events(resource, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource: A resource ID to subscribe to. The resource can be a task or project. (required) + :param str sync: A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.* + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EventResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_events_with_http_info(resource, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_events_with_http_info(resource, opts, **kwargs) # noqa: E501 + return data + + def get_events_with_http_info(self, resource, opts, **kwargs): # noqa: E501 + """Get events on a resource # noqa: E501 + + Returns the full record for all events that have occurred since the sync token was created. A `GET` request to the endpoint `/[path_to_resource]/events` can be made in lieu of including the resource ID in the data for the request. Asana limits a single sync token to 100 events. If more than 100 events exist for a given resource, `has_more: true` will be returned in the response, indicating that there are more events to pull. *Note: The resource returned will be the resource that triggered the event. This may be different from the one that the events were requested for. For example, a subscription to a project will contain events for tasks contained within the project.* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_with_http_info(resource, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource: A resource ID to subscribe to. The resource can be a task or project. (required) + :param str sync: A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.* + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: EventResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_events" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource' is set + if (resource is None): + raise ValueError("Missing the required parameter `resource` when calling `get_events`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['resource'] = resource + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/events', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return EventIterator( + self.api_client, + { + "resource_path": '/events', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/events', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/goal_relationships_api.py b/asana/api/goal_relationships_api.py new file mode 100644 index 00000000..13711369 --- /dev/null +++ b/asana/api/goal_relationships_api.py @@ -0,0 +1,761 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class GoalRelationshipsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_supporting_relationship(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Add a supporting goal relationship # noqa: E501 + + Creates a goal relationship by adding a supporting resource to a given goal. Returns the newly created goal relationship record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_supporting_relationship(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The supporting resource to be added to the goal (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_supporting_relationship_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_supporting_relationship_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + return data + + def add_supporting_relationship_with_http_info(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Add a supporting goal relationship # noqa: E501 + + Creates a goal relationship by adding a supporting resource to a given goal. Returns the newly created goal relationship record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_supporting_relationship_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The supporting resource to be added to the goal (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_supporting_relationship" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_supporting_relationship`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `add_supporting_relationship`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/addSupportingRelationship', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}/addSupportingRelationship', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}/addSupportingRelationship', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_goal_relationship(self, goal_relationship_gid, opts, **kwargs): # noqa: E501 + """Get a goal relationship # noqa: E501 + + Returns the complete updated goal relationship record for a single goal relationship. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goal_relationship(goal_relationship_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_relationship_gid: Globally unique identifier for the goal relationship. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_goal_relationship_with_http_info(goal_relationship_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_goal_relationship_with_http_info(goal_relationship_gid, opts, **kwargs) # noqa: E501 + return data + + def get_goal_relationship_with_http_info(self, goal_relationship_gid, opts, **kwargs): # noqa: E501 + """Get a goal relationship # noqa: E501 + + Returns the complete updated goal relationship record for a single goal relationship. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goal_relationship_with_http_info(goal_relationship_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_relationship_gid: Globally unique identifier for the goal relationship. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_goal_relationship" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'goal_relationship_gid' is set + if (goal_relationship_gid is None): + raise ValueError("Missing the required parameter `goal_relationship_gid` when calling `get_goal_relationship`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_relationship_gid'] = goal_relationship_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goal_relationships/{goal_relationship_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goal_relationships/{goal_relationship_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goal_relationships/{goal_relationship_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_goal_relationships(self, supported_goal, opts, **kwargs): # noqa: E501 + """Get goal relationships # noqa: E501 + + Returns compact goal relationship records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goal_relationships(supported_goal, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str supported_goal: Globally unique identifier for the supported goal in the goal relationship. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str resource_subtype: If provided, filter to goal relationships with a given resource_subtype. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_goal_relationships_with_http_info(supported_goal, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_goal_relationships_with_http_info(supported_goal, opts, **kwargs) # noqa: E501 + return data + + def get_goal_relationships_with_http_info(self, supported_goal, opts, **kwargs): # noqa: E501 + """Get goal relationships # noqa: E501 + + Returns compact goal relationship records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goal_relationships_with_http_info(supported_goal, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str supported_goal: Globally unique identifier for the supported goal in the goal relationship. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str resource_subtype: If provided, filter to goal relationships with a given resource_subtype. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_goal_relationships" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'supported_goal' is set + if (supported_goal is None): + raise ValueError("Missing the required parameter `supported_goal` when calling `get_goal_relationships`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['supported_goal'] = supported_goal + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goal_relationships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/goal_relationships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/goal_relationships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_supporting_relationship(self, body, goal_gid, **kwargs): # noqa: E501 + """Removes a supporting goal relationship # noqa: E501 + + Removes a goal relationship for a given parent goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_supporting_relationship(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The supporting resource to be removed from the goal (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_supporting_relationship_with_http_info(body, goal_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_supporting_relationship_with_http_info(body, goal_gid, **kwargs) # noqa: E501 + return data + + def remove_supporting_relationship_with_http_info(self, body, goal_gid, **kwargs): # noqa: E501 + """Removes a supporting goal relationship # noqa: E501 + + Removes a goal relationship for a given parent goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_supporting_relationship_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The supporting resource to be removed from the goal (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_supporting_relationship" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_supporting_relationship`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `remove_supporting_relationship`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/removeSupportingRelationship', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}/removeSupportingRelationship', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}/removeSupportingRelationship', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_goal_relationship(self, body, goal_relationship_gid, opts, **kwargs): # noqa: E501 + """Update a goal relationship # noqa: E501 + + An existing goal relationship can be updated by making a PUT request on the URL for that goal relationship. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal relationship record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_goal_relationship(body, goal_relationship_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the goal relationship. (required) + :param str goal_relationship_gid: Globally unique identifier for the goal relationship. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_goal_relationship_with_http_info(body, goal_relationship_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_goal_relationship_with_http_info(body, goal_relationship_gid, opts, **kwargs) # noqa: E501 + return data + + def update_goal_relationship_with_http_info(self, body, goal_relationship_gid, opts, **kwargs): # noqa: E501 + """Update a goal relationship # noqa: E501 + + An existing goal relationship can be updated by making a PUT request on the URL for that goal relationship. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal relationship record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_goal_relationship_with_http_info(body, goal_relationship_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the goal relationship. (required) + :param str goal_relationship_gid: Globally unique identifier for the goal relationship. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalRelationshipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_goal_relationship" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_goal_relationship`") # noqa: E501 + # verify the required parameter 'goal_relationship_gid' is set + if (goal_relationship_gid is None): + raise ValueError("Missing the required parameter `goal_relationship_gid` when calling `update_goal_relationship`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_relationship_gid'] = goal_relationship_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goal_relationships/{goal_relationship_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goal_relationships/{goal_relationship_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goal_relationships/{goal_relationship_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/goals_api.py b/asana/api/goals_api.py new file mode 100644 index 00000000..79fb51d9 --- /dev/null +++ b/asana/api/goals_api.py @@ -0,0 +1,1486 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class GoalsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_followers(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Add a collaborator to a goal # noqa: E501 + + Adds followers to a goal. Returns the goal the followers were added to. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_followers(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to be added as collaborators (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_followers_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_followers_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + return data + + def add_followers_with_http_info(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Add a collaborator to a goal # noqa: E501 + + Adds followers to a goal. Returns the goal the followers were added to. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_followers_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to be added as collaborators (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_followers" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_followers`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `add_followers`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_goal(self, body, opts, **kwargs): # noqa: E501 + """Create a goal # noqa: E501 + + Creates a new goal in a workspace or team. Returns the full record of the newly created goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_goal(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The goal to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_goal_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_goal_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_goal_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a goal # noqa: E501 + + Creates a new goal in a workspace or team. Returns the full record of the newly created goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_goal_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The goal to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_goal" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_goal`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_goal_metric(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Create a goal metric # noqa: E501 + + Creates and adds a goal metric to a specified goal. Note that this replaces an existing goal metric if one already exists. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_goal_metric(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The goal metric to create. (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_goal_metric_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_goal_metric_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + return data + + def create_goal_metric_with_http_info(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Create a goal metric # noqa: E501 + + Creates and adds a goal metric to a specified goal. Note that this replaces an existing goal metric if one already exists. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_goal_metric_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The goal metric to create. (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_goal_metric" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_goal_metric`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `create_goal_metric`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/setMetric', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}/setMetric', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}/setMetric', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_goal(self, goal_gid, **kwargs): # noqa: E501 + """Delete a goal # noqa: E501 + + A specific, existing goal can be deleted by making a DELETE request on the URL for that goal. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_goal(goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_gid: Globally unique identifier for the goal. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_goal_with_http_info(goal_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_goal_with_http_info(goal_gid, **kwargs) # noqa: E501 + return data + + def delete_goal_with_http_info(self, goal_gid, **kwargs): # noqa: E501 + """Delete a goal # noqa: E501 + + A specific, existing goal can be deleted by making a DELETE request on the URL for that goal. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_goal_with_http_info(goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_gid: Globally unique identifier for the goal. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_goal" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `delete_goal`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_goal(self, goal_gid, opts, **kwargs): # noqa: E501 + """Get a goal # noqa: E501 + + Returns the complete goal record for a single goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goal(goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_goal_with_http_info(goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_goal_with_http_info(goal_gid, opts, **kwargs) # noqa: E501 + return data + + def get_goal_with_http_info(self, goal_gid, opts, **kwargs): # noqa: E501 + """Get a goal # noqa: E501 + + Returns the complete goal record for a single goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goal_with_http_info(goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_goal" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `get_goal`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_goals(self, opts, **kwargs): # noqa: E501 + """Get goals # noqa: E501 + + Returns compact goal records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goals(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio: Globally unique identifier for supporting portfolio. + :param str project: Globally unique identifier for supporting project. + :param str task: Globally unique identifier for supporting task. + :param bool is_workspace_level: Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter. + :param str team: Globally unique identifier for the team. + :param str workspace: Globally unique identifier for the workspace. + :param list[str] time_periods: Globally unique identifiers for the time periods. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_goals_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_goals_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_goals_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get goals # noqa: E501 + + Returns compact goal records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_goals_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio: Globally unique identifier for supporting portfolio. + :param str project: Globally unique identifier for supporting project. + :param str task: Globally unique identifier for supporting task. + :param bool is_workspace_level: Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter. + :param str team: Globally unique identifier for the team. + :param str workspace: Globally unique identifier for the workspace. + :param list[str] time_periods: Globally unique identifiers for the time periods. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_goals" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/goals', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/goals', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_parent_goals_for_goal(self, goal_gid, opts, **kwargs): # noqa: E501 + """Get parent goals from a goal # noqa: E501 + + Returns a compact representation of all of the parent goals of a goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_parent_goals_for_goal(goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_parent_goals_for_goal_with_http_info(goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_parent_goals_for_goal_with_http_info(goal_gid, opts, **kwargs) # noqa: E501 + return data + + def get_parent_goals_for_goal_with_http_info(self, goal_gid, opts, **kwargs): # noqa: E501 + """Get parent goals from a goal # noqa: E501 + + Returns a compact representation of all of the parent goals of a goal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_parent_goals_for_goal_with_http_info(goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_parent_goals_for_goal" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `get_parent_goals_for_goal`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/parentGoals', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/goals/{goal_gid}/parentGoals', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/goals/{goal_gid}/parentGoals', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_followers(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Remove a collaborator from a goal # noqa: E501 + + Removes followers from a goal. Returns the goal the followers were removed from. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_followers(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to be removed as collaborators (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_followers_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.remove_followers_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + return data + + def remove_followers_with_http_info(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Remove a collaborator from a goal # noqa: E501 + + Removes followers from a goal. Returns the goal the followers were removed from. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_followers_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to be removed as collaborators (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_followers" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_followers`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `remove_followers`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_goal(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Update a goal # noqa: E501 + + An existing goal can be updated by making a PUT request on the URL for that goal. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_goal(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the goal. (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_goal_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_goal_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + return data + + def update_goal_with_http_info(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Update a goal # noqa: E501 + + An existing goal can be updated by making a PUT request on the URL for that goal. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_goal_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the goal. (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_goal" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_goal`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `update_goal`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_goal_metric(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Update a goal metric # noqa: E501 + + Updates a goal's existing metric's `current_number_value` if one exists, otherwise responds with a 400 status code. Returns the complete updated goal metric record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_goal_metric(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the goal metric. (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_goal_metric_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_goal_metric_with_http_info(body, goal_gid, opts, **kwargs) # noqa: E501 + return data + + def update_goal_metric_with_http_info(self, body, goal_gid, opts, **kwargs): # noqa: E501 + """Update a goal metric # noqa: E501 + + Updates a goal's existing metric's `current_number_value` if one exists, otherwise responds with a 400 status code. Returns the complete updated goal metric record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_goal_metric_with_http_info(body, goal_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the goal metric. (required) + :param str goal_gid: Globally unique identifier for the goal. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: GoalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_goal_metric" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_goal_metric`") # noqa: E501 + # verify the required parameter 'goal_gid' is set + if (goal_gid is None): + raise ValueError("Missing the required parameter `goal_gid` when calling `update_goal_metric`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['goal_gid'] = goal_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/goals/{goal_gid}/setMetricCurrentValue', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/goals/{goal_gid}/setMetricCurrentValue', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/goals/{goal_gid}/setMetricCurrentValue', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/jobs_api.py b/asana/api/jobs_api.py new file mode 100644 index 00000000..f97ce7f9 --- /dev/null +++ b/asana/api/jobs_api.py @@ -0,0 +1,172 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class JobsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_job(self, job_gid, opts, **kwargs): # noqa: E501 + """Get a job by id # noqa: E501 + + Returns the full record for a job. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_job(job_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str job_gid: Globally unique identifier for the job. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_job_with_http_info(job_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_job_with_http_info(job_gid, opts, **kwargs) # noqa: E501 + return data + + def get_job_with_http_info(self, job_gid, opts, **kwargs): # noqa: E501 + """Get a job by id # noqa: E501 + + Returns the full record for a job. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_job_with_http_info(job_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str job_gid: Globally unique identifier for the job. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_job" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'job_gid' is set + if (job_gid is None): + raise ValueError("Missing the required parameter `job_gid` when calling `get_job`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['job_gid'] = job_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/jobs/{job_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/jobs/{job_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/jobs/{job_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/memberships_api.py b/asana/api/memberships_api.py new file mode 100644 index 00000000..aa9de516 --- /dev/null +++ b/asana/api/memberships_api.py @@ -0,0 +1,589 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class MembershipsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_membership(self, opts, **kwargs): # noqa: E501 + """Create a membership # noqa: E501 + + Creates a new membership in a `goal`. `Teams` or `users` can be a member of `goals`. Returns the full record of the newly created membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_membership(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the membership. + :return: MembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_membership_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.create_membership_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def create_membership_with_http_info(self, opts, **kwargs): # noqa: E501 + """Create a membership # noqa: E501 + + Creates a new membership in a `goal`. `Teams` or `users` can be a member of `goals`. Returns the full record of the newly created membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_membership_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the membership. + :return: MembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_membership" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/memberships', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/memberships', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/memberships', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_membership(self, membership_gid, **kwargs): # noqa: E501 + """Delete a membership # noqa: E501 + + A specific, existing membership can be deleted by making a `DELETE` request on the URL for that membership. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_membership(membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str membership_gid: Globally unique identifier for the membership. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_membership_with_http_info(membership_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_membership_with_http_info(membership_gid, **kwargs) # noqa: E501 + return data + + def delete_membership_with_http_info(self, membership_gid, **kwargs): # noqa: E501 + """Delete a membership # noqa: E501 + + A specific, existing membership can be deleted by making a `DELETE` request on the URL for that membership. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_membership_with_http_info(membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str membership_gid: Globally unique identifier for the membership. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_membership" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'membership_gid' is set + if (membership_gid is None): + raise ValueError("Missing the required parameter `membership_gid` when calling `delete_membership`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['membership_gid'] = membership_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/memberships/{membership_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/memberships/{membership_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/memberships/{membership_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_membership(self, membership_gid, opts, **kwargs): # noqa: E501 + """Get a membership # noqa: E501 + + Returns compact `project_membership` record for a single membership. `GET` only supports project memberships currently # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_membership(membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str membership_gid: Globally unique identifier for the membership. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectMembershipCompactResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_membership_with_http_info(membership_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_membership_with_http_info(membership_gid, opts, **kwargs) # noqa: E501 + return data + + def get_membership_with_http_info(self, membership_gid, opts, **kwargs): # noqa: E501 + """Get a membership # noqa: E501 + + Returns compact `project_membership` record for a single membership. `GET` only supports project memberships currently # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_membership_with_http_info(membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str membership_gid: Globally unique identifier for the membership. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectMembershipCompactResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_membership" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'membership_gid' is set + if (membership_gid is None): + raise ValueError("Missing the required parameter `membership_gid` when calling `get_membership`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['membership_gid'] = membership_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/memberships/{membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/memberships/{membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/memberships/{membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_memberships(self, opts, **kwargs): # noqa: E501 + """Get multiple memberships # noqa: E501 + + Returns compact `goal_membership` or `project_membership` records. The possible types for `parent` in this request are `goal` or `project`. An additional member (user GID or team GID) can be passed in to filter to a specific membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_memberships(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str parent: Globally unique identifier for `goal` or `project`. + :param str member: Globally unique identifier for `team` or `user`. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: MembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_memberships_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_memberships_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_memberships_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple memberships # noqa: E501 + + Returns compact `goal_membership` or `project_membership` records. The possible types for `parent` in this request are `goal` or `project`. An additional member (user GID or team GID) can be passed in to filter to a specific membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_memberships_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str parent: Globally unique identifier for `goal` or `project`. + :param str member: Globally unique identifier for `team` or `user`. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: MembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_memberships" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/organization_exports_api.py b/asana/api/organization_exports_api.py new file mode 100644 index 00000000..b30a1427 --- /dev/null +++ b/asana/api/organization_exports_api.py @@ -0,0 +1,314 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class OrganizationExportsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_organization_export(self, body, opts, **kwargs): # noqa: E501 + """Create an organization export request # noqa: E501 + + This method creates a request to export an Organization. Asana will complete the export at some point after you create the request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_organization_export(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The organization to export. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: OrganizationExportResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_organization_export_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_organization_export_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_organization_export_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create an organization export request # noqa: E501 + + This method creates a request to export an Organization. Asana will complete the export at some point after you create the request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_organization_export_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The organization to export. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: OrganizationExportResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_export" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_organization_export`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/organization_exports', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/organization_exports', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/organization_exports', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_organization_export(self, organization_export_gid, opts, **kwargs): # noqa: E501 + """Get details on an org export request # noqa: E501 + + Returns details of a previously-requested Organization export. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_organization_export(organization_export_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str organization_export_gid: Globally unique identifier for the organization export. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: OrganizationExportResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_organization_export_with_http_info(organization_export_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_organization_export_with_http_info(organization_export_gid, opts, **kwargs) # noqa: E501 + return data + + def get_organization_export_with_http_info(self, organization_export_gid, opts, **kwargs): # noqa: E501 + """Get details on an org export request # noqa: E501 + + Returns details of a previously-requested Organization export. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_organization_export_with_http_info(organization_export_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str organization_export_gid: Globally unique identifier for the organization export. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: OrganizationExportResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_organization_export" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'organization_export_gid' is set + if (organization_export_gid is None): + raise ValueError("Missing the required parameter `organization_export_gid` when calling `get_organization_export`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['organization_export_gid'] = organization_export_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/organization_exports/{organization_export_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/organization_exports/{organization_export_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/organization_exports/{organization_export_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/portfolio_memberships_api.py b/asana/api/portfolio_memberships_api.py new file mode 100644 index 00000000..eb9d29c3 --- /dev/null +++ b/asana/api/portfolio_memberships_api.py @@ -0,0 +1,466 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class PortfolioMembershipsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_portfolio_membership(self, portfolio_membership_gid, opts, **kwargs): # noqa: E501 + """Get a portfolio membership # noqa: E501 + + Returns the complete portfolio record for a single portfolio membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_membership(portfolio_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_portfolio_membership_with_http_info(portfolio_membership_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_portfolio_membership_with_http_info(portfolio_membership_gid, opts, **kwargs) # noqa: E501 + return data + + def get_portfolio_membership_with_http_info(self, portfolio_membership_gid, opts, **kwargs): # noqa: E501 + """Get a portfolio membership # noqa: E501 + + Returns the complete portfolio record for a single portfolio membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_membership_with_http_info(portfolio_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_portfolio_membership" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'portfolio_membership_gid' is set + if (portfolio_membership_gid is None): + raise ValueError("Missing the required parameter `portfolio_membership_gid` when calling `get_portfolio_membership`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_membership_gid'] = portfolio_membership_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolio_memberships/{portfolio_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolio_memberships/{portfolio_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolio_memberships/{portfolio_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_portfolio_memberships(self, opts, **kwargs): # noqa: E501 + """Get multiple portfolio memberships # noqa: E501 + + Returns a list of portfolio memberships in compact representation. You must specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_memberships(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio: The portfolio to filter results on. + :param str workspace: The workspace to filter results on. + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_portfolio_memberships_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_portfolio_memberships_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_portfolio_memberships_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple portfolio memberships # noqa: E501 + + Returns a list of portfolio memberships in compact representation. You must specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_memberships_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio: The portfolio to filter results on. + :param str workspace: The workspace to filter results on. + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_portfolio_memberships" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolio_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/portfolio_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/portfolio_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_portfolio_memberships_for_portfolio(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get memberships from a portfolio # noqa: E501 + + Returns the compact portfolio membership records for the portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_memberships_for_portfolio(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_portfolio_memberships_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_portfolio_memberships_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def get_portfolio_memberships_for_portfolio_with_http_info(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get memberships from a portfolio # noqa: E501 + + Returns the compact portfolio membership records for the portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_memberships_for_portfolio_with_http_info(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_portfolio_memberships_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `get_portfolio_memberships_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/portfolio_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/portfolios/{portfolio_gid}/portfolio_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/portfolio_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/portfolios_api.py b/asana/api/portfolios_api.py new file mode 100644 index 00000000..f480fe14 --- /dev/null +++ b/asana/api/portfolios_api.py @@ -0,0 +1,1768 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class PortfoliosApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_custom_field_setting_for_portfolio(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Add a custom field to a portfolio # noqa: E501 + + Custom fields are associated with portfolios by way of custom field settings. This method creates a setting for the portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_custom_field_setting_for_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: CustomFieldSettingResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_custom_field_setting_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_custom_field_setting_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + return data + + def add_custom_field_setting_for_portfolio_with_http_info(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Add a custom field to a portfolio # noqa: E501 + + Custom fields are associated with portfolios by way of custom field settings. This method creates a setting for the portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_custom_field_setting_for_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: CustomFieldSettingResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_custom_field_setting_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_custom_field_setting_for_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `add_custom_field_setting_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/addCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}/addCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/addCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_item_for_portfolio(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Add a portfolio item # noqa: E501 + + Add an item to a portfolio. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_item_for_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the item being inserted. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_item_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_item_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + return data + + def add_item_for_portfolio_with_http_info(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Add a portfolio item # noqa: E501 + + Add an item to a portfolio. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_item_for_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the item being inserted. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_item_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_item_for_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `add_item_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/addItem', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}/addItem', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/addItem', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_members_for_portfolio(self, body, portfolio_gid, opts, **kwargs): # noqa: E501 + """Add users to a portfolio # noqa: E501 + + Adds the specified list of users as members of the portfolio. Returns the updated portfolio record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_members_for_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being added. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_members_for_portfolio_with_http_info(body, portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_members_for_portfolio_with_http_info(body, portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def add_members_for_portfolio_with_http_info(self, body, portfolio_gid, opts, **kwargs): # noqa: E501 + """Add users to a portfolio # noqa: E501 + + Adds the specified list of users as members of the portfolio. Returns the updated portfolio record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_members_for_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being added. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_members_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_members_for_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `add_members_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/addMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}/addMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/addMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_portfolio(self, body, opts, **kwargs): # noqa: E501 + """Create a portfolio # noqa: E501 + + Creates a new portfolio in the given workspace with the supplied name. Note that portfolios created in the Asana UI may have some state (like the “Priority” custom field) which is automatically added to the portfolio when it is created. Portfolios created via our API will *not* be created with the same initial state to allow integrations to create their own starting state on a portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_portfolio(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The portfolio to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_portfolio_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_portfolio_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_portfolio_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a portfolio # noqa: E501 + + Creates a new portfolio in the given workspace with the supplied name. Note that portfolios created in the Asana UI may have some state (like the “Priority” custom field) which is automatically added to the portfolio when it is created. Portfolios created via our API will *not* be created with the same initial state to allow integrations to create their own starting state on a portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_portfolio_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The portfolio to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_portfolio(self, portfolio_gid, **kwargs): # noqa: E501 + """Delete a portfolio # noqa: E501 + + An existing portfolio can be deleted by making a DELETE request on the URL for that portfolio. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_portfolio(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_portfolio_with_http_info(portfolio_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_portfolio_with_http_info(portfolio_gid, **kwargs) # noqa: E501 + return data + + def delete_portfolio_with_http_info(self, portfolio_gid, **kwargs): # noqa: E501 + """Delete a portfolio # noqa: E501 + + An existing portfolio can be deleted by making a DELETE request on the URL for that portfolio. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_portfolio_with_http_info(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `delete_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_items_for_portfolio(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get portfolio items # noqa: E501 + + Get a list of the items in compact form in a portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_items_for_portfolio(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_items_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_items_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def get_items_for_portfolio_with_http_info(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get portfolio items # noqa: E501 + + Get a list of the items in compact form in a portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_items_for_portfolio_with_http_info(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_items_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `get_items_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/items', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/portfolios/{portfolio_gid}/items', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/items', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_portfolio(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get a portfolio # noqa: E501 + + Returns the complete portfolio record for a single portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def get_portfolio_with_http_info(self, portfolio_gid, opts, **kwargs): # noqa: E501 + """Get a portfolio # noqa: E501 + + Returns the complete portfolio record for a single portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolio_with_http_info(portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `get_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_portfolios(self, workspace, opts, **kwargs): # noqa: E501 + """Get multiple portfolios # noqa: E501 + + Returns a list of the portfolios in compact representation that are owned by the current API user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolios(workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace or organization to filter portfolios on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str owner: The user who owns the portfolio. Currently, API users can only get a list of portfolios that they themselves own, unless the request is made from a Service Account. In the case of a Service Account, if this parameter is specified, then all portfolios owned by this parameter are returned. Otherwise, all portfolios across the workspace are returned. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_portfolios_with_http_info(workspace, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_portfolios_with_http_info(workspace, opts, **kwargs) # noqa: E501 + return data + + def get_portfolios_with_http_info(self, workspace, opts, **kwargs): # noqa: E501 + """Get multiple portfolios # noqa: E501 + + Returns a list of the portfolios in compact representation that are owned by the current API user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_portfolios_with_http_info(workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace or organization to filter portfolios on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str owner: The user who owns the portfolio. Currently, API users can only get a list of portfolios that they themselves own, unless the request is made from a Service Account. In the case of a Service Account, if this parameter is specified, then all portfolios owned by this parameter are returned. Otherwise, all portfolios across the workspace are returned. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_portfolios" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace' is set + if (workspace is None): + raise ValueError("Missing the required parameter `workspace` when calling `get_portfolios`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['workspace'] = workspace + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/portfolios', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/portfolios', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_custom_field_setting_for_portfolio(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Remove a custom field from a portfolio # noqa: E501 + + Removes a custom field setting from a portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_custom_field_setting_for_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting being removed. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_custom_field_setting_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_custom_field_setting_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + return data + + def remove_custom_field_setting_for_portfolio_with_http_info(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Remove a custom field from a portfolio # noqa: E501 + + Removes a custom field setting from a portfolio. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_custom_field_setting_for_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting being removed. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_custom_field_setting_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_custom_field_setting_for_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `remove_custom_field_setting_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_item_for_portfolio(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Remove a portfolio item # noqa: E501 + + Remove an item from a portfolio. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_item_for_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the item being removed. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_item_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_item_for_portfolio_with_http_info(body, portfolio_gid, **kwargs) # noqa: E501 + return data + + def remove_item_for_portfolio_with_http_info(self, body, portfolio_gid, **kwargs): # noqa: E501 + """Remove a portfolio item # noqa: E501 + + Remove an item from a portfolio. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_item_for_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the item being removed. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_item_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_item_for_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `remove_item_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeItem', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeItem', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeItem', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_members_for_portfolio(self, body, portfolio_gid, opts, **kwargs): # noqa: E501 + """Remove users from a portfolio # noqa: E501 + + Removes the specified list of users from members of the portfolio. Returns the updated portfolio record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_members_for_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being removed. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_members_for_portfolio_with_http_info(body, portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.remove_members_for_portfolio_with_http_info(body, portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def remove_members_for_portfolio_with_http_info(self, body, portfolio_gid, opts, **kwargs): # noqa: E501 + """Remove users from a portfolio # noqa: E501 + + Removes the specified list of users from members of the portfolio. Returns the updated portfolio record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_members_for_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being removed. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_members_for_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_members_for_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `remove_members_for_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}/removeMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_portfolio(self, body, portfolio_gid, opts, **kwargs): # noqa: E501 + """Update a portfolio # noqa: E501 + + An existing portfolio can be updated by making a PUT request on the URL for that portfolio. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated portfolio record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_portfolio(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the portfolio. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_portfolio_with_http_info(body, portfolio_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_portfolio_with_http_info(body, portfolio_gid, opts, **kwargs) # noqa: E501 + return data + + def update_portfolio_with_http_info(self, body, portfolio_gid, opts, **kwargs): # noqa: E501 + """Update a portfolio # noqa: E501 + + An existing portfolio can be updated by making a PUT request on the URL for that portfolio. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated portfolio record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_portfolio_with_http_info(body, portfolio_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the portfolio. (required) + :param str portfolio_gid: Globally unique identifier for the portfolio. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: PortfolioResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_portfolio" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_portfolio`") # noqa: E501 + # verify the required parameter 'portfolio_gid' is set + if (portfolio_gid is None): + raise ValueError("Missing the required parameter `portfolio_gid` when calling `update_portfolio`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['portfolio_gid'] = portfolio_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/portfolios/{portfolio_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/project_briefs_api.py b/asana/api/project_briefs_api.py new file mode 100644 index 00000000..dd62c7e2 --- /dev/null +++ b/asana/api/project_briefs_api.py @@ -0,0 +1,604 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class ProjectBriefsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_project_brief(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Create a project brief # noqa: E501 + + Creates a new project brief. Returns the full record of the newly created project brief. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_brief(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project brief to create. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectBriefResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_project_brief_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_project_brief_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def create_project_brief_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Create a project brief # noqa: E501 + + Creates a new project brief. Returns the full record of the newly created project brief. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_brief_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project brief to create. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectBriefResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_brief" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_project_brief`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `create_project_brief`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/project_briefs', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/project_briefs', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/project_briefs', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_brief(self, project_brief_gid, **kwargs): # noqa: E501 + """Delete a project brief # noqa: E501 + + Deletes a specific, existing project brief. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_brief(project_brief_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_brief_gid: Globally unique identifier for the project brief. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_project_brief_with_http_info(project_brief_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_project_brief_with_http_info(project_brief_gid, **kwargs) # noqa: E501 + return data + + def delete_project_brief_with_http_info(self, project_brief_gid, **kwargs): # noqa: E501 + """Delete a project brief # noqa: E501 + + Deletes a specific, existing project brief. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_brief_with_http_info(project_brief_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_brief_gid: Globally unique identifier for the project brief. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_brief" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_brief_gid' is set + if (project_brief_gid is None): + raise ValueError("Missing the required parameter `project_brief_gid` when calling `delete_project_brief`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_brief_gid'] = project_brief_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_brief(self, project_brief_gid, opts, **kwargs): # noqa: E501 + """Get a project brief # noqa: E501 + + Get the full record for a project brief. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_brief(project_brief_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_brief_gid: Globally unique identifier for the project brief. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectBriefResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_brief_with_http_info(project_brief_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_brief_with_http_info(project_brief_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_brief_with_http_info(self, project_brief_gid, opts, **kwargs): # noqa: E501 + """Get a project brief # noqa: E501 + + Get the full record for a project brief. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_brief_with_http_info(project_brief_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_brief_gid: Globally unique identifier for the project brief. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectBriefResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_brief" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_brief_gid' is set + if (project_brief_gid is None): + raise ValueError("Missing the required parameter `project_brief_gid` when calling `get_project_brief`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_brief_gid'] = project_brief_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_brief(self, body, project_brief_gid, opts, **kwargs): # noqa: E501 + """Update a project brief # noqa: E501 + + An existing project brief can be updated by making a PUT request on the URL for that project brief. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated project brief record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_project_brief(body, project_brief_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the project brief. (required) + :param str project_brief_gid: Globally unique identifier for the project brief. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectBriefResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_project_brief_with_http_info(body, project_brief_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_project_brief_with_http_info(body, project_brief_gid, opts, **kwargs) # noqa: E501 + return data + + def update_project_brief_with_http_info(self, body, project_brief_gid, opts, **kwargs): # noqa: E501 + """Update a project brief # noqa: E501 + + An existing project brief can be updated by making a PUT request on the URL for that project brief. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated project brief record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_project_brief_with_http_info(body, project_brief_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the project brief. (required) + :param str project_brief_gid: Globally unique identifier for the project brief. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectBriefResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_brief" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_project_brief`") # noqa: E501 + # verify the required parameter 'project_brief_gid' is set + if (project_brief_gid is None): + raise ValueError("Missing the required parameter `project_brief_gid` when calling `update_project_brief`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_brief_gid'] = project_brief_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_briefs/{project_brief_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/project_memberships_api.py b/asana/api/project_memberships_api.py new file mode 100644 index 00000000..da8e2484 --- /dev/null +++ b/asana/api/project_memberships_api.py @@ -0,0 +1,320 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class ProjectMembershipsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_project_membership(self, project_membership_gid, opts, **kwargs): # noqa: E501 + """Get a project membership # noqa: E501 + + Returns the complete project record for a single project membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_membership(project_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectMembershipNormalResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_membership_with_http_info(project_membership_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_membership_with_http_info(project_membership_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_membership_with_http_info(self, project_membership_gid, opts, **kwargs): # noqa: E501 + """Get a project membership # noqa: E501 + + Returns the complete project record for a single project membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_membership_with_http_info(project_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectMembershipNormalResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_membership" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_membership_gid' is set + if (project_membership_gid is None): + raise ValueError("Missing the required parameter `project_membership_gid` when calling `get_project_membership`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_membership_gid'] = project_membership_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_memberships/{project_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_memberships/{project_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_memberships/{project_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_memberships_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get memberships from a project # noqa: E501 + + Returns the compact project membership records for the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_memberships_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectMembershipCompactArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_memberships_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_memberships_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_memberships_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get memberships from a project # noqa: E501 + + Returns the compact project membership records for the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_memberships_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectMembershipCompactArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_memberships_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_project_memberships_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/project_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/projects/{project_gid}/project_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/projects/{project_gid}/project_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/project_statuses_api.py b/asana/api/project_statuses_api.py new file mode 100644 index 00000000..a483fbaa --- /dev/null +++ b/asana/api/project_statuses_api.py @@ -0,0 +1,602 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class ProjectStatusesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_project_status_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Create a project status # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates` route.* Creates a new status update on the project. Returns the full record of the newly created project status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_status_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project status to create. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectStatusResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_project_status_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_project_status_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def create_project_status_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Create a project status # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates` route.* Creates a new status update on the project. Returns the full record of the newly created project status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_status_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project status to create. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectStatusResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_status_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_project_status_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `create_project_status_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/project_statuses', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/project_statuses', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/project_statuses', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_status(self, project_status_gid, **kwargs): # noqa: E501 + """Delete a project status # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Deletes a specific, existing project status update. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_status(project_status_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_status_gid: The project status update to get. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_project_status_with_http_info(project_status_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_project_status_with_http_info(project_status_gid, **kwargs) # noqa: E501 + return data + + def delete_project_status_with_http_info(self, project_status_gid, **kwargs): # noqa: E501 + """Delete a project status # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Deletes a specific, existing project status update. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_status_with_http_info(project_status_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_status_gid: The project status update to get. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_status" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_status_gid' is set + if (project_status_gid is None): + raise ValueError("Missing the required parameter `project_status_gid` when calling `delete_project_status`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_status_gid'] = project_status_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_statuses/{project_status_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_statuses/{project_status_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_statuses/{project_status_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_status(self, project_status_gid, opts, **kwargs): # noqa: E501 + """Get a project status # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Returns the complete record for a single status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_status(project_status_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_status_gid: The project status update to get. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectStatusResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_status_with_http_info(project_status_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_status_with_http_info(project_status_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_status_with_http_info(self, project_status_gid, opts, **kwargs): # noqa: E501 + """Get a project status # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Returns the complete record for a single status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_status_with_http_info(project_status_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_status_gid: The project status update to get. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectStatusResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_status" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_status_gid' is set + if (project_status_gid is None): + raise ValueError("Missing the required parameter `project_status_gid` when calling `get_project_status`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_status_gid'] = project_status_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_statuses/{project_status_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_statuses/{project_status_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_statuses/{project_status_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_statuses_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get statuses from a project # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates` route.* Returns the compact project status update records for all updates on the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_statuses_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectStatusResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_statuses_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_statuses_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_statuses_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get statuses from a project # noqa: E501 + + *Deprecated: new integrations should prefer the `/status_updates` route.* Returns the compact project status update records for all updates on the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_statuses_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectStatusResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_statuses_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_project_statuses_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/project_statuses', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/projects/{project_gid}/project_statuses', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/projects/{project_gid}/project_statuses', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/project_templates_api.py b/asana/api/project_templates_api.py new file mode 100644 index 00000000..403c9f09 --- /dev/null +++ b/asana/api/project_templates_api.py @@ -0,0 +1,743 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class ProjectTemplatesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_project_template(self, project_template_gid, **kwargs): # noqa: E501 + """Delete a project template # noqa: E501 + + A specific, existing project template can be deleted by making a DELETE request on the URL for that project template. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_template(project_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_template_gid: Globally unique identifier for the project template. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_project_template_with_http_info(project_template_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_project_template_with_http_info(project_template_gid, **kwargs) # noqa: E501 + return data + + def delete_project_template_with_http_info(self, project_template_gid, **kwargs): # noqa: E501 + """Delete a project template # noqa: E501 + + A specific, existing project template can be deleted by making a DELETE request on the URL for that project template. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_template_with_http_info(project_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_template_gid: Globally unique identifier for the project template. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_template" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_template_gid' is set + if (project_template_gid is None): + raise ValueError("Missing the required parameter `project_template_gid` when calling `delete_project_template`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_template_gid'] = project_template_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_templates/{project_template_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_templates/{project_template_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_templates/{project_template_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_template(self, project_template_gid, opts, **kwargs): # noqa: E501 + """Get a project template # noqa: E501 + + Returns the complete project template record for a single project template. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_template(project_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_template_gid: Globally unique identifier for the project template. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectTemplateResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_template_with_http_info(project_template_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_template_with_http_info(project_template_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_template_with_http_info(self, project_template_gid, opts, **kwargs): # noqa: E501 + """Get a project template # noqa: E501 + + Returns the complete project template record for a single project template. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_template_with_http_info(project_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_template_gid: Globally unique identifier for the project template. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectTemplateResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_template" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_template_gid' is set + if (project_template_gid is None): + raise ValueError("Missing the required parameter `project_template_gid` when calling `get_project_template`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_template_gid'] = project_template_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_templates/{project_template_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_templates/{project_template_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_templates/{project_template_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_templates(self, opts, **kwargs): # noqa: E501 + """Get multiple project templates # noqa: E501 + + Returns the compact project template records for all project templates in the given team or workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_templates(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace to filter results on. + :param str team: The team to filter projects on. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectTemplateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_templates_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_templates_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_project_templates_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple project templates # noqa: E501 + + Returns the compact project template records for all project templates in the given team or workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_templates_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace to filter results on. + :param str team: The team to filter projects on. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectTemplateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_templates" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_templates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/project_templates', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/project_templates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_templates_for_team(self, team_gid, opts, **kwargs): # noqa: E501 + """Get a team's project templates # noqa: E501 + + Returns the compact project template records for all project templates in the team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_templates_for_team(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectTemplateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_templates_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_templates_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_templates_for_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501 + """Get a team's project templates # noqa: E501 + + Returns the compact project template records for all project templates in the team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_templates_for_team_with_http_info(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectTemplateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_templates_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `get_project_templates_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/project_templates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/teams/{team_gid}/project_templates', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/teams/{team_gid}/project_templates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 instantiate_project(self, project_template_gid, opts, **kwargs): # noqa: E501 + """Instantiate a project from a project template # noqa: E501 + + Creates and returns a job that will asynchronously handle the project instantiation. To form this request, it is recommended to first make a request to [get a project template](/reference/getprojecttemplate). Then, from the response, copy the `gid` from the object in the `requested_dates` array. This `gid` should be used in `requested_dates` to instantiate a project. _Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the [is_organization](/reference/workspaces) parameter._ # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.instantiate_project(project_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_template_gid: Globally unique identifier for the project template. (required) + :param dict body: Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.instantiate_project_with_http_info(project_template_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.instantiate_project_with_http_info(project_template_gid, opts, **kwargs) # noqa: E501 + return data + + def instantiate_project_with_http_info(self, project_template_gid, opts, **kwargs): # noqa: E501 + """Instantiate a project from a project template # noqa: E501 + + Creates and returns a job that will asynchronously handle the project instantiation. To form this request, it is recommended to first make a request to [get a project template](/reference/getprojecttemplate). Then, from the response, copy the `gid` from the object in the `requested_dates` array. This `gid` should be used in `requested_dates` to instantiate a project. _Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the [is_organization](/reference/workspaces) parameter._ # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.instantiate_project_with_http_info(project_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_template_gid: Globally unique identifier for the project template. (required) + :param dict body: Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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 instantiate_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_template_gid' is set + if (project_template_gid is None): + raise ValueError("Missing the required parameter `project_template_gid` when calling `instantiate_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_template_gid'] = project_template_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/project_templates/{project_template_gid}/instantiateProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/project_templates/{project_template_gid}/instantiateProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/project_templates/{project_template_gid}/instantiateProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/projects_api.py b/asana/api/projects_api.py new file mode 100644 index 00000000..7ec1c9ee --- /dev/null +++ b/asana/api/projects_api.py @@ -0,0 +1,2796 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class ProjectsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_custom_field_setting_for_project(self, body, project_gid, **kwargs): # noqa: E501 + """Add a custom field to a project # noqa: E501 + + Custom fields are associated with projects by way of custom field settings. This method creates a setting for the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_custom_field_setting_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :return: CustomFieldSettingResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_custom_field_setting_for_project_with_http_info(body, project_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_custom_field_setting_for_project_with_http_info(body, project_gid, **kwargs) # noqa: E501 + return data + + def add_custom_field_setting_for_project_with_http_info(self, body, project_gid, **kwargs): # noqa: E501 + """Add a custom field to a project # noqa: E501 + + Custom fields are associated with projects by way of custom field settings. This method creates a setting for the project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_custom_field_setting_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :return: CustomFieldSettingResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_custom_field_setting_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_custom_field_setting_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `add_custom_field_setting_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/addCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/addCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/addCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_followers_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Add followers to a project # noqa: E501 + + Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive \"tasks added\" notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_followers_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the followers being added. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_followers_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_followers_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def add_followers_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Add followers to a project # noqa: E501 + + Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive \"tasks added\" notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_followers_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the followers being added. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_followers_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_followers_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `add_followers_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_members_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Add users to a project # noqa: E501 + + Adds the specified list of users as members of the project. Note that a user being added as a member may also be added as a *follower* as a result of this operation. This is because the user's default notification settings (i.e., in the \"Notifcations\" tab of \"My Profile Settings\") will override this endpoint's default behavior of setting \"Tasks added\" notifications to `false`. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_members_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being added. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_members_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_members_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def add_members_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Add users to a project # noqa: E501 + + Adds the specified list of users as members of the project. Note that a user being added as a member may also be added as a *follower* as a result of this operation. This is because the user's default notification settings (i.e., in the \"Notifcations\" tab of \"My Profile Settings\") will override this endpoint's default behavior of setting \"Tasks added\" notifications to `false`. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_members_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being added. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_members_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_members_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `add_members_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/addMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/addMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/addMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project(self, body, opts, **kwargs): # noqa: E501 + """Create a project # noqa: E501 + + Create a new project in a workspace or team. Every project is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the `workspace` parameter regardless of whether or not it is an organization. If the workspace for your project is an organization, you must also supply a `team` to share the project with. Returns the full record of the newly created project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_project_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_project_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_project_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a project # noqa: E501 + + Create a new project in a workspace or team. Every project is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the `workspace` parameter regardless of whether or not it is an organization. If the workspace for your project is an organization, you must also supply a `team` to share the project with. Returns the full record of the newly created project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_for_team(self, body, team_gid, opts, **kwargs): # noqa: E501 + """Create a project in a team # noqa: E501 + + Creates a project shared with the given team. Returns the full record of the newly created project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_for_team(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new project to create. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_project_for_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_project_for_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501 + return data + + def create_project_for_team_with_http_info(self, body, team_gid, opts, **kwargs): # noqa: E501 + """Create a project in a team # noqa: E501 + + Creates a project shared with the given team. Returns the full record of the newly created project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_for_team_with_http_info(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new project to create. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_project_for_team`") # noqa: E501 + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `create_project_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/teams/{team_gid}/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/teams/{team_gid}/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_for_workspace(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Create a project in a workspace # noqa: E501 + + Creates a project in the workspace. If the workspace for your project is an organization, you must also supply a team to share the project with. Returns the full record of the newly created project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_for_workspace(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new project to create. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_project_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_project_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def create_project_for_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Create a project in a workspace # noqa: E501 + + Creates a project in the workspace. If the workspace for your project is an organization, you must also supply a team to share the project with. Returns the full record of the newly created project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_project_for_workspace_with_http_info(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new project to create. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_project_for_workspace`") # noqa: E501 + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `create_project_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspaces/{workspace_gid}/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/projects', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project(self, project_gid, **kwargs): # noqa: E501 + """Delete a project # noqa: E501 + + A specific, existing project can be deleted by making a DELETE request on the URL for that project. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_project_with_http_info(project_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_project_with_http_info(project_gid, **kwargs) # noqa: E501 + return data + + def delete_project_with_http_info(self, project_gid, **kwargs): # noqa: E501 + """Delete a project # noqa: E501 + + A specific, existing project can be deleted by making a DELETE request on the URL for that project. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `delete_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 duplicate_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Duplicate a project # noqa: E501 + + Creates and returns a job that will asynchronously handle the duplication. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.duplicate_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param dict body: Describes the duplicate's name and the elements that will be duplicated. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.duplicate_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.duplicate_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def duplicate_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Duplicate a project # noqa: E501 + + Creates and returns a job that will asynchronously handle the duplication. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.duplicate_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param dict body: Describes the duplicate's name and the elements that will be duplicated. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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 duplicate_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `duplicate_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/duplicate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/duplicate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/duplicate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get a project # noqa: E501 + + Returns the complete project record for a single project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get a project # noqa: E501 + + Returns the complete project record for a single project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_projects(self, opts, **kwargs): # noqa: E501 + """Get multiple projects # noqa: E501 + + Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned. *Note: This endpoint may timeout for large domains. Try filtering by team!* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str workspace: The workspace or organization to filter projects on. + :param str team: The team to filter projects on. + :param bool archived: Only return projects whose `archived` field takes on the value of this parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_projects_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_projects_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_projects_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple projects # noqa: E501 + + Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned. *Note: This endpoint may timeout for large domains. Try filtering by team!* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str workspace: The workspace or organization to filter projects on. + :param str team: The team to filter projects on. + :param bool archived: Only return projects whose `archived` field takes on the value of this parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_projects" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/projects', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_projects_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get projects a task is in # noqa: E501 + + Returns a compact representation of all of the projects the task is in. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_projects_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_projects_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_projects_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get projects a task is in # noqa: E501 + + Returns a compact representation of all of the projects the task is in. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_projects_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_projects_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/projects', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_projects_for_team(self, team_gid, opts, **kwargs): # noqa: E501 + """Get a team's projects # noqa: E501 + + Returns the compact project records for all projects in the team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_for_team(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param bool archived: Only return projects whose `archived` field takes on the value of this parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_projects_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_projects_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + return data + + def get_projects_for_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501 + """Get a team's projects # noqa: E501 + + Returns the compact project records for all projects in the team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_for_team_with_http_info(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param bool archived: Only return projects whose `archived` field takes on the value of this parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_projects_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `get_projects_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/teams/{team_gid}/projects', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/teams/{team_gid}/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_projects_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get all projects in a workspace # noqa: E501 + + Returns the compact project records for all projects in the workspace. *Note: This endpoint may timeout for large domains. Prefer the `/teams/{team_gid}/projects` endpoint.* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param bool archived: Only return projects whose `archived` field takes on the value of this parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_projects_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_projects_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_projects_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get all projects in a workspace # noqa: E501 + + Returns the compact project records for all projects in the workspace. *Note: This endpoint may timeout for large domains. Prefer the `/teams/{team_gid}/projects` endpoint.* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_projects_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param bool archived: Only return projects whose `archived` field takes on the value of this parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_projects_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_projects_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/projects', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/projects', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_task_counts_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get task count of a project # noqa: E501 + + Get an object that holds task count fields. **All fields are excluded by default**. You must [opt in](/docs/inputoutput-options) using `opt_fields` to get any information from this endpoint. This endpoint has an additional [rate limit](/docs/rate-limits) and each field counts especially high against our [cost limits](/docs/rate-limits#cost-limits). Milestones are just tasks, so they are included in the `num_tasks`, `num_incomplete_tasks`, and `num_completed_tasks` counts. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_counts_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskCountResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_task_counts_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_task_counts_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_task_counts_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get task count of a project # noqa: E501 + + Get an object that holds task count fields. **All fields are excluded by default**. You must [opt in](/docs/inputoutput-options) using `opt_fields` to get any information from this endpoint. This endpoint has an additional [rate limit](/docs/rate-limits) and each field counts especially high against our [cost limits](/docs/rate-limits#cost-limits). Milestones are just tasks, so they are included in the `num_tasks`, `num_incomplete_tasks`, and `num_completed_tasks` counts. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_counts_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskCountResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_task_counts_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_task_counts_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/task_counts', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/task_counts', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/task_counts', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 project_save_as_template(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Create a project template from a project # noqa: E501 + + Creates and returns a job that will asynchronously handle the project template creation. Note that while the resulting project template can be accessed with the API, it won't be visible in the Asana UI until Project Templates 2.0 is launched in the app. See more in [this forum post](https://forum.asana.com/t/a-new-api-for-project-templates/156432). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.project_save_as_template(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.project_save_as_template_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.project_save_as_template_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def project_save_as_template_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Create a project template from a project # noqa: E501 + + Creates and returns a job that will asynchronously handle the project template creation. Note that while the resulting project template can be accessed with the API, it won't be visible in the Asana UI until Project Templates 2.0 is launched in the app. See more in [this forum post](https://forum.asana.com/t/a-new-api-for-project-templates/156432). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.project_save_as_template_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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 project_save_as_template" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `project_save_as_template`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `project_save_as_template`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/saveAsTemplate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/saveAsTemplate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/saveAsTemplate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_custom_field_setting_for_project(self, body, project_gid, **kwargs): # noqa: E501 + """Remove a custom field from a project # noqa: E501 + + Removes a custom field setting from a project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_custom_field_setting_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting being removed. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_custom_field_setting_for_project_with_http_info(body, project_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_custom_field_setting_for_project_with_http_info(body, project_gid, **kwargs) # noqa: E501 + return data + + def remove_custom_field_setting_for_project_with_http_info(self, body, project_gid, **kwargs): # noqa: E501 + """Remove a custom field from a project # noqa: E501 + + Removes a custom field setting from a project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_custom_field_setting_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the custom field setting being removed. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_custom_field_setting_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_custom_field_setting_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `remove_custom_field_setting_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/removeCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/removeCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/removeCustomFieldSetting', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_followers_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Remove followers from a project # noqa: E501 + + Removes the specified list of users from following the project, this will not affect project membership status. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_followers_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the followers being removed. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_followers_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.remove_followers_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def remove_followers_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Remove followers from a project # noqa: E501 + + Removes the specified list of users from following the project, this will not affect project membership status. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_followers_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the followers being removed. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_followers_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_followers_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `remove_followers_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_members_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Remove users from a project # noqa: E501 + + Removes the specified list of users from members of the project. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_members_for_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being removed. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_members_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.remove_members_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def remove_members_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Remove users from a project # noqa: E501 + + Removes the specified list of users from members of the project. Returns the updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_members_for_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the members being removed. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_members_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_members_for_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `remove_members_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/removeMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/removeMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/removeMembers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Update a project # noqa: E501 + + A specific, existing project can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_project(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the project. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501 + return data + + def update_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501 + """Update a project # noqa: E501 + + A specific, existing project can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated project record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_project_with_http_info(body, project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the project. (required) + :param str project_gid: Globally unique identifier for the project. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: ProjectResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_project`") # noqa: E501 + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `update_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/rules_api.py b/asana/api/rules_api.py new file mode 100644 index 00000000..a99d8b31 --- /dev/null +++ b/asana/api/rules_api.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class RulesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def trigger_rule(self, body, rule_trigger_gid, **kwargs): # noqa: E501 + """Trigger a rule # noqa: E501 + + Trigger a rule which uses an [\"incoming web request\"](/docs/incoming-web-requests) trigger. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.trigger_rule(body, rule_trigger_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: A dictionary of variables accessible from within the rule. (required) + :param str rule_trigger_gid: The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. (required) + :return: RuleTriggerResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.trigger_rule_with_http_info(body, rule_trigger_gid, **kwargs) # noqa: E501 + else: + (data) = self.trigger_rule_with_http_info(body, rule_trigger_gid, **kwargs) # noqa: E501 + return data + + def trigger_rule_with_http_info(self, body, rule_trigger_gid, **kwargs): # noqa: E501 + """Trigger a rule # noqa: E501 + + Trigger a rule which uses an [\"incoming web request\"](/docs/incoming-web-requests) trigger. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.trigger_rule_with_http_info(body, rule_trigger_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: A dictionary of variables accessible from within the rule. (required) + :param str rule_trigger_gid: The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. (required) + :return: RuleTriggerResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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 trigger_rule" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `trigger_rule`") # noqa: E501 + # verify the required parameter 'rule_trigger_gid' is set + if (rule_trigger_gid is None): + raise ValueError("Missing the required parameter `rule_trigger_gid` when calling `trigger_rule`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['rule_trigger_gid'] = rule_trigger_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/rule_triggers/{rule_trigger_gid}/run', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/rule_triggers/{rule_trigger_gid}/run', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/rule_triggers/{rule_trigger_gid}/run', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/sections_api.py b/asana/api/sections_api.py new file mode 100644 index 00000000..5c0cf580 --- /dev/null +++ b/asana/api/sections_api.py @@ -0,0 +1,1030 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class SectionsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_task_for_section(self, section_gid, opts, **kwargs): # noqa: E501 + """Add task to section # noqa: E501 + + Add a task to a specific, existing section. This will remove the task from other sections of the project. The task will be inserted at the top of a section unless an insert_before or insert_after parameter is declared. This does not work for separators (tasks with the resource_subtype of section). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_task_for_section(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param dict body: The task and optionally the insert location. + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_task_for_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_task_for_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + return data + + def add_task_for_section_with_http_info(self, section_gid, opts, **kwargs): # noqa: E501 + """Add task to section # noqa: E501 + + Add a task to a specific, existing section. This will remove the task from other sections of the project. The task will be inserted at the top of a section unless an insert_before or insert_after parameter is declared. This does not work for separators (tasks with the resource_subtype of section). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_task_for_section_with_http_info(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param dict body: The task and optionally the insert location. + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_task_for_section" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'section_gid' is set + if (section_gid is None): + raise ValueError("Missing the required parameter `section_gid` when calling `add_task_for_section`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['section_gid'] = section_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/sections/{section_gid}/addTask', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/sections/{section_gid}/addTask', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/sections/{section_gid}/addTask', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_section_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Create a section in a project # noqa: E501 + + Creates a new section in a project. Returns the full record of the newly created section. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_section_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param dict body: The section to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_section_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_section_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def create_section_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Create a section in a project # noqa: E501 + + Creates a new section in a project. Returns the full record of the newly created section. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_section_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param dict body: The section to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_section_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `create_section_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/sections', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/sections', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/sections', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_section(self, section_gid, **kwargs): # noqa: E501 + """Delete a section # noqa: E501 + + A specific, existing section can be deleted by making a DELETE request on the URL for that section. Note that sections must be empty to be deleted. The last remaining section cannot be deleted. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_section(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_section_with_http_info(section_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_section_with_http_info(section_gid, **kwargs) # noqa: E501 + return data + + def delete_section_with_http_info(self, section_gid, **kwargs): # noqa: E501 + """Delete a section # noqa: E501 + + A specific, existing section can be deleted by making a DELETE request on the URL for that section. Note that sections must be empty to be deleted. The last remaining section cannot be deleted. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_section_with_http_info(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_section" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'section_gid' is set + if (section_gid is None): + raise ValueError("Missing the required parameter `section_gid` when calling `delete_section`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['section_gid'] = section_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/sections/{section_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/sections/{section_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/sections/{section_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_section(self, section_gid, opts, **kwargs): # noqa: E501 + """Get a section # noqa: E501 + + Returns the complete record for a single section. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_section(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + return data + + def get_section_with_http_info(self, section_gid, opts, **kwargs): # noqa: E501 + """Get a section # noqa: E501 + + Returns the complete record for a single section. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_section_with_http_info(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_section" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'section_gid' is set + if (section_gid is None): + raise ValueError("Missing the required parameter `section_gid` when calling `get_section`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['section_gid'] = section_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/sections/{section_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/sections/{section_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/sections/{section_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_sections_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get sections in a project # noqa: E501 + + Returns the compact records for all sections in the specified project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_sections_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_sections_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_sections_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_sections_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get sections in a project # noqa: E501 + + Returns the compact records for all sections in the specified project. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_sections_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_sections_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_sections_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/sections', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/projects/{project_gid}/sections', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/projects/{project_gid}/sections', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 insert_section_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Move or Insert sections # noqa: E501 + + Move sections relative to each other. One of `before_section` or `after_section` is required. Sections cannot be moved between projects. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.insert_section_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param dict body: The section's move action. + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.insert_section_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.insert_section_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def insert_section_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Move or Insert sections # noqa: E501 + + Move sections relative to each other. One of `before_section` or `after_section` is required. Sections cannot be moved between projects. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.insert_section_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param dict body: The section's move action. + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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 insert_section_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `insert_section_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/sections/insert', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/projects/{project_gid}/sections/insert', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/projects/{project_gid}/sections/insert', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_section(self, section_gid, opts, **kwargs): # noqa: E501 + """Update a section # noqa: E501 + + A specific, existing section can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. (note that at this time, the only field that can be updated is the `name` field.) When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated section record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_section(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param dict body: The section to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + return data + + def update_section_with_http_info(self, section_gid, opts, **kwargs): # noqa: E501 + """Update a section # noqa: E501 + + A specific, existing section can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. (note that at this time, the only field that can be updated is the `name` field.) When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated section record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_section_with_http_info(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param dict body: The section to create. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: SectionResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_section" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'section_gid' is set + if (section_gid is None): + raise ValueError("Missing the required parameter `section_gid` when calling `update_section`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['section_gid'] = section_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/sections/{section_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/sections/{section_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/sections/{section_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/status_updates_api.py b/asana/api/status_updates_api.py new file mode 100644 index 00000000..bb677511 --- /dev/null +++ b/asana/api/status_updates_api.py @@ -0,0 +1,602 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class StatusUpdatesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_status_for_object(self, body, opts, **kwargs): # noqa: E501 + """Create a status update # noqa: E501 + + Creates a new status update on an object. Returns the full record of the newly created status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_status_for_object(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The status update to create. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StatusUpdateResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_status_for_object_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_status_for_object_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_status_for_object_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a status update # noqa: E501 + + Creates a new status update on an object. Returns the full record of the newly created status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_status_for_object_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The status update to create. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StatusUpdateResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_status_for_object" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_status_for_object`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/status_updates', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/status_updates', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/status_updates', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_status(self, status_update_gid, **kwargs): # noqa: E501 + """Delete a status update # noqa: E501 + + Deletes a specific, existing status update. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_status(status_update_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str status_update_gid: The status update to get. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_status_with_http_info(status_update_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_status_with_http_info(status_update_gid, **kwargs) # noqa: E501 + return data + + def delete_status_with_http_info(self, status_update_gid, **kwargs): # noqa: E501 + """Delete a status update # noqa: E501 + + Deletes a specific, existing status update. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_status_with_http_info(status_update_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str status_update_gid: The status update to get. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_status" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'status_update_gid' is set + if (status_update_gid is None): + raise ValueError("Missing the required parameter `status_update_gid` when calling `delete_status`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['status_update_gid'] = status_update_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/status_updates/{status_update_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/status_updates/{status_update_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/status_updates/{status_update_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_status(self, status_update_gid, opts, **kwargs): # noqa: E501 + """Get a status update # noqa: E501 + + Returns the complete record for a single status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_status(status_update_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str status_update_gid: The status update to get. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StatusUpdateResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_status_with_http_info(status_update_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_status_with_http_info(status_update_gid, opts, **kwargs) # noqa: E501 + return data + + def get_status_with_http_info(self, status_update_gid, opts, **kwargs): # noqa: E501 + """Get a status update # noqa: E501 + + Returns the complete record for a single status update. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_status_with_http_info(status_update_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str status_update_gid: The status update to get. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StatusUpdateResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_status" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'status_update_gid' is set + if (status_update_gid is None): + raise ValueError("Missing the required parameter `status_update_gid` when calling `get_status`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['status_update_gid'] = status_update_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/status_updates/{status_update_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/status_updates/{status_update_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/status_updates/{status_update_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_statuses_for_object(self, parent, opts, **kwargs): # noqa: E501 + """Get status updates from an object # noqa: E501 + + Returns the compact status update records for all updates on the object. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_statuses_for_object(parent, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str parent: Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param datetime created_since: Only return statuses that have been created since the given time. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StatusUpdateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_statuses_for_object_with_http_info(parent, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_statuses_for_object_with_http_info(parent, opts, **kwargs) # noqa: E501 + return data + + def get_statuses_for_object_with_http_info(self, parent, opts, **kwargs): # noqa: E501 + """Get status updates from an object # noqa: E501 + + Returns the compact status update records for all updates on the object. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_statuses_for_object_with_http_info(parent, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str parent: Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param datetime created_since: Only return statuses that have been created since the given time. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StatusUpdateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_statuses_for_object" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'parent' is set + if (parent is None): + raise ValueError("Missing the required parameter `parent` when calling `get_statuses_for_object`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['parent'] = parent + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/status_updates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/status_updates', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/status_updates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/stories_api.py b/asana/api/stories_api.py new file mode 100644 index 00000000..dbb5e45a --- /dev/null +++ b/asana/api/stories_api.py @@ -0,0 +1,750 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class StoriesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_story_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Create a story on a task # noqa: E501 + + Adds a story to a task. This endpoint currently only allows for comment stories to be created. The comment will be authored by the currently authenticated user, and timestamped when the server receives the request. Returns the full record for the new story added to the task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_story_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The story to create. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_story_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_story_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def create_story_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Create a story on a task # noqa: E501 + + Adds a story to a task. This endpoint currently only allows for comment stories to be created. The comment will be authored by the currently authenticated user, and timestamped when the server receives the request. Returns the full record for the new story added to the task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_story_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The story to create. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_story_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_story_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `create_story_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/stories', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/stories', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/stories', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_story(self, story_gid, **kwargs): # noqa: E501 + """Delete a story # noqa: E501 + + Deletes a story. A user can only delete stories they have created. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_story(story_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str story_gid: Globally unique identifier for the story. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_story_with_http_info(story_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_story_with_http_info(story_gid, **kwargs) # noqa: E501 + return data + + def delete_story_with_http_info(self, story_gid, **kwargs): # noqa: E501 + """Delete a story # noqa: E501 + + Deletes a story. A user can only delete stories they have created. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_story_with_http_info(story_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str story_gid: Globally unique identifier for the story. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_story" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'story_gid' is set + if (story_gid is None): + raise ValueError("Missing the required parameter `story_gid` when calling `delete_story`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['story_gid'] = story_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/stories/{story_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/stories/{story_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/stories/{story_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_stories_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get stories from a task # noqa: E501 + + Returns the compact records for all stories on the task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_stories_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_stories_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_stories_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_stories_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get stories from a task # noqa: E501 + + Returns the compact records for all stories on the task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_stories_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_stories_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_stories_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/stories', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/stories', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/stories', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_story(self, story_gid, opts, **kwargs): # noqa: E501 + """Get a story # noqa: E501 + + Returns the full record for a single story. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_story(story_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str story_gid: Globally unique identifier for the story. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_story_with_http_info(story_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_story_with_http_info(story_gid, opts, **kwargs) # noqa: E501 + return data + + def get_story_with_http_info(self, story_gid, opts, **kwargs): # noqa: E501 + """Get a story # noqa: E501 + + Returns the full record for a single story. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_story_with_http_info(story_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str story_gid: Globally unique identifier for the story. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_story" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'story_gid' is set + if (story_gid is None): + raise ValueError("Missing the required parameter `story_gid` when calling `get_story`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['story_gid'] = story_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/stories/{story_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/stories/{story_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/stories/{story_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_story(self, body, story_gid, opts, **kwargs): # noqa: E501 + """Update a story # noqa: E501 + + Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_story(body, story_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The comment story to update. (required) + :param str story_gid: Globally unique identifier for the story. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_story_with_http_info(body, story_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_story_with_http_info(body, story_gid, opts, **kwargs) # noqa: E501 + return data + + def update_story_with_http_info(self, body, story_gid, opts, **kwargs): # noqa: E501 + """Update a story # noqa: E501 + + Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_story_with_http_info(body, story_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The comment story to update. (required) + :param str story_gid: Globally unique identifier for the story. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: StoryResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_story" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_story`") # noqa: E501 + # verify the required parameter 'story_gid' is set + if (story_gid is None): + raise ValueError("Missing the required parameter `story_gid` when calling `update_story`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['story_gid'] = story_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/stories/{story_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/stories/{story_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/stories/{story_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/tags_api.py b/asana/api/tags_api.py new file mode 100644 index 00000000..17c6b4f7 --- /dev/null +++ b/asana/api/tags_api.py @@ -0,0 +1,1171 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TagsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_tag(self, body, opts, **kwargs): # noqa: E501 + """Create a tag # noqa: E501 + + Creates a new tag in a workspace or organization. Every tag is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the workspace parameter regardless of whether or not it is an organization. Returns the full record of the newly created tag. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_tag(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_tag_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_tag_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_tag_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a tag # noqa: E501 + + Creates a new tag in a workspace or organization. Every tag is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the workspace parameter regardless of whether or not it is an organization. Returns the full record of the newly created tag. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_tag_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tag" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_tag`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tags', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tags', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tags', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tag_for_workspace(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Create a tag in a workspace # noqa: E501 + + Creates a new tag in a workspace or organization. Every tag is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the workspace parameter regardless of whether or not it is an organization. Returns the full record of the newly created tag. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_tag_for_workspace(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to create. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_tag_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_tag_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def create_tag_for_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Create a tag in a workspace # noqa: E501 + + Creates a new tag in a workspace or organization. Every tag is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the workspace parameter regardless of whether or not it is an organization. Returns the full record of the newly created tag. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_tag_for_workspace_with_http_info(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to create. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tag_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_tag_for_workspace`") # noqa: E501 + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `create_tag_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/tags', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspaces/{workspace_gid}/tags', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/tags', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tag(self, tag_gid, **kwargs): # noqa: E501 + """Delete a tag # noqa: E501 + + A specific, existing tag can be deleted by making a DELETE request on the URL for that tag. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tag(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_tag_with_http_info(tag_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_tag_with_http_info(tag_gid, **kwargs) # noqa: E501 + return data + + def delete_tag_with_http_info(self, tag_gid, **kwargs): # noqa: E501 + """Delete a tag # noqa: E501 + + A specific, existing tag can be deleted by making a DELETE request on the URL for that tag. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tag_with_http_info(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tag" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tag_gid' is set + if (tag_gid is None): + raise ValueError("Missing the required parameter `tag_gid` when calling `delete_tag`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['tag_gid'] = tag_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tags/{tag_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tags/{tag_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tags/{tag_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tag(self, tag_gid, opts, **kwargs): # noqa: E501 + """Get a tag # noqa: E501 + + Returns the complete tag record for a single tag. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tag(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tag_with_http_info(self, tag_gid, opts, **kwargs): # noqa: E501 + """Get a tag # noqa: E501 + + Returns the complete tag record for a single tag. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tag_with_http_info(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tag" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tag_gid' is set + if (tag_gid is None): + raise ValueError("Missing the required parameter `tag_gid` when calling `get_tag`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['tag_gid'] = tag_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tags/{tag_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tags/{tag_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tags/{tag_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tags(self, opts, **kwargs): # noqa: E501 + """Get multiple tags # noqa: E501 + + Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tags(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str workspace: The workspace to filter tags on. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tags_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tags_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_tags_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple tags # noqa: E501 + + Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tags_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str workspace: The workspace to filter tags on. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tags" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tags', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tags_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get a task's tags # noqa: E501 + + Get a compact representation of all of the tags the task has. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tags_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tags_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tags_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tags_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get a task's tags # noqa: E501 + + Get a compact representation of all of the tags the task has. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tags_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tags_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_tags_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/tags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/tags', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/tags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tags_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get tags in a workspace # noqa: E501 + + Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tags_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tags_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tags_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tags_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get tags in a workspace # noqa: E501 + + Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tags_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tags_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_tags_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/tags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/tags', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/tags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tag(self, tag_gid, opts, **kwargs): # noqa: E501 + """Update a tag # noqa: E501 + + Updates the properties of a tag. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the tag. Returns the complete updated tag record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_tag(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501 + return data + + def update_tag_with_http_info(self, tag_gid, opts, **kwargs): # noqa: E501 + """Update a tag # noqa: E501 + + Updates the properties of a tag. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the tag. Returns the complete updated tag record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_tag_with_http_info(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TagResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tag" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tag_gid' is set + if (tag_gid is None): + raise ValueError("Missing the required parameter `tag_gid` when calling `update_tag`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['tag_gid'] = tag_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tags/{tag_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tags/{tag_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tags/{tag_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/task_templates_api.py b/asana/api/task_templates_api.py new file mode 100644 index 00000000..06baec90 --- /dev/null +++ b/asana/api/task_templates_api.py @@ -0,0 +1,459 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TaskTemplatesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_task_template(self, task_template_gid, opts, **kwargs): # noqa: E501 + """Get a task template # noqa: E501 + + Returns the complete task template record for a single task template. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_template(task_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_template_gid: Globally unique identifier for the task template. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskTemplateResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_task_template_with_http_info(task_template_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_task_template_with_http_info(task_template_gid, opts, **kwargs) # noqa: E501 + return data + + def get_task_template_with_http_info(self, task_template_gid, opts, **kwargs): # noqa: E501 + """Get a task template # noqa: E501 + + Returns the complete task template record for a single task template. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_template_with_http_info(task_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_template_gid: Globally unique identifier for the task template. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskTemplateResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_task_template" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_template_gid' is set + if (task_template_gid is None): + raise ValueError("Missing the required parameter `task_template_gid` when calling `get_task_template`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_template_gid'] = task_template_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/task_templates/{task_template_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/task_templates/{task_template_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/task_templates/{task_template_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_task_templates(self, opts, **kwargs): # noqa: E501 + """Get multiple task templates # noqa: E501 + + Returns the compact task template records for some filtered set of task templates. You must specify a `project` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_templates(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str project: The project to filter task templates on. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskTemplateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_task_templates_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_task_templates_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_task_templates_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple task templates # noqa: E501 + + Returns the compact task template records for some filtered set of task templates. You must specify a `project` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_templates_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str project: The project to filter task templates on. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskTemplateResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_task_templates" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/task_templates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/task_templates', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/task_templates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 instantiate_task(self, task_template_gid, opts, **kwargs): # noqa: E501 + """Instantiate a task from a task template # noqa: E501 + + Creates and returns a job that will asynchronously handle the task instantiation. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.instantiate_task(task_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_template_gid: Globally unique identifier for the task template. (required) + :param dict body: Describes the inputs used for instantiating a task - the task's name. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.instantiate_task_with_http_info(task_template_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.instantiate_task_with_http_info(task_template_gid, opts, **kwargs) # noqa: E501 + return data + + def instantiate_task_with_http_info(self, task_template_gid, opts, **kwargs): # noqa: E501 + """Instantiate a task from a task template # noqa: E501 + + Creates and returns a job that will asynchronously handle the task instantiation. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.instantiate_task_with_http_info(task_template_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_template_gid: Globally unique identifier for the task template. (required) + :param dict body: Describes the inputs used for instantiating a task - the task's name. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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 instantiate_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_template_gid' is set + if (task_template_gid is None): + raise ValueError("Missing the required parameter `task_template_gid` when calling `instantiate_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_template_gid'] = task_template_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = opts['body'] + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/task_templates/{task_template_gid}/instantiateTask', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/task_templates/{task_template_gid}/instantiateTask', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/task_templates/{task_template_gid}/instantiateTask', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/tasks_api.py b/asana/api/tasks_api.py new file mode 100644 index 00000000..06180826 --- /dev/null +++ b/asana/api/tasks_api.py @@ -0,0 +1,3936 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TasksApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_dependencies_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Set dependencies for a task # noqa: E501 + + Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_dependencies_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to set as dependencies. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_dependencies_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_dependencies_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def add_dependencies_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Set dependencies for a task # noqa: E501 + + Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_dependencies_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to set as dependencies. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_dependencies_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_dependencies_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `add_dependencies_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/addDependencies', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/addDependencies', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/addDependencies', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_dependents_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Set dependents for a task # noqa: E501 + + Marks a set of tasks as dependents of this task, if they are not already dependents. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_dependents_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to add as dependents. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_dependents_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_dependents_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def add_dependents_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Set dependents for a task # noqa: E501 + + Marks a set of tasks as dependents of this task, if they are not already dependents. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_dependents_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to add as dependents. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_dependents_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_dependents_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `add_dependents_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/addDependents', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/addDependents', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/addDependents', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_followers_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Add followers to a task # noqa: E501 + + Adds followers to a task. Returns an empty data block. Each task can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated task record, described above. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_followers_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to add to the task. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_followers_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_followers_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def add_followers_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Add followers to a task # noqa: E501 + + Adds followers to a task. Returns an empty data block. Each task can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated task record, described above. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_followers_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to add to the task. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_followers_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_followers_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `add_followers_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/addFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Add a project to a task # noqa: E501 + + Adds the task to the specified project, in the optional location specified. If no location arguments are given, the task will be added to the end of the project. `addProject` can also be used to reorder a task within a project or section that already contains it. At most one of `insert_before`, `insert_after`, or `section` should be specified. Inserting into a section in an non-order-dependent way can be done by specifying section, otherwise, to insert within a section in a particular place, specify `insert_before` or `insert_after` and a task within the section to anchor the position of this task. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_project_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project to add the task to. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_project_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_project_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def add_project_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Add a project to a task # noqa: E501 + + Adds the task to the specified project, in the optional location specified. If no location arguments are given, the task will be added to the end of the project. `addProject` can also be used to reorder a task within a project or section that already contains it. At most one of `insert_before`, `insert_after`, or `section` should be specified. Inserting into a section in an non-order-dependent way can be done by specifying section, otherwise, to insert within a section in a particular place, specify `insert_before` or `insert_after` and a task within the section to anchor the position of this task. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_project_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project to add the task to. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_project_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `add_project_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/addProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/addProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/addProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tag_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Add a tag to a task # noqa: E501 + + Adds a tag to a task. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_tag_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to add to the task. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_tag_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.add_tag_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def add_tag_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Add a tag to a task # noqa: E501 + + Adds a tag to a task. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_tag_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to add to the task. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tag_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_tag_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `add_tag_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/addTag', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/addTag', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/addTag', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_subtask_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Create a subtask # noqa: E501 + + Creates a new subtask and adds it to the parent task. Returns the full record for the newly created subtask. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_subtask_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new subtask to create. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_subtask_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_subtask_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def create_subtask_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Create a subtask # noqa: E501 + + Creates a new subtask and adds it to the parent task. Returns the full record for the newly created subtask. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_subtask_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new subtask to create. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_subtask_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_subtask_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `create_subtask_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/subtasks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/subtasks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/subtasks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_task(self, body, opts, **kwargs): # noqa: E501 + """Create a task # noqa: E501 + + Creating a new task is as easy as POSTing to the `/tasks` endpoint with a data block containing the fields you’d like to set on the task. Any unspecified fields will take on default values. Every task is required to be created in a specific workspace, and this workspace cannot be changed once set. The workspace need not be set explicitly if you specify `projects` or a `parent` task instead. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_task(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The task to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_task_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_task_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_task_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a task # noqa: E501 + + Creating a new task is as easy as POSTing to the `/tasks` endpoint with a data block containing the fields you’d like to set on the task. Any unspecified fields will take on default values. Every task is required to be created in a specific workspace, and this workspace cannot be changed once set. The workspace need not be set explicitly if you specify `projects` or a `parent` task instead. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_task_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The task to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_task(self, task_gid, **kwargs): # noqa: E501 + """Delete a task # noqa: E501 + + A specific, existing task can be deleted by making a DELETE request on the URL for that task. Deleted tasks go into the “trash” of the user making the delete request. Tasks can be recovered from the trash within a period of 30 days; afterward they are completely removed from the system. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_task_with_http_info(task_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_task_with_http_info(task_gid, **kwargs) # noqa: E501 + return data + + def delete_task_with_http_info(self, task_gid, **kwargs): # noqa: E501 + """Delete a task # noqa: E501 + + A specific, existing task can be deleted by making a DELETE request on the URL for that task. Deleted tasks go into the “trash” of the user making the delete request. Tasks can be recovered from the trash within a period of 30 days; afterward they are completely removed from the system. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `delete_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 duplicate_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Duplicate a task # noqa: E501 + + Creates and returns a job that will asynchronously handle the duplication. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.duplicate_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Describes the duplicate's name and the fields that will be duplicated. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.duplicate_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.duplicate_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def duplicate_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Duplicate a task # noqa: E501 + + Creates and returns a job that will asynchronously handle the duplication. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.duplicate_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Describes the duplicate's name and the fields that will be duplicated. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: JobResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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 duplicate_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `duplicate_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `duplicate_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/duplicate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/duplicate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/duplicate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_dependencies_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get dependencies from a task # noqa: E501 + + Returns the compact representations of all of the dependencies of a task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dependencies_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_dependencies_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_dependencies_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_dependencies_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get dependencies from a task # noqa: E501 + + Returns the compact representations of all of the dependencies of a task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dependencies_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_dependencies_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_dependencies_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/dependencies', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/dependencies', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/dependencies', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_dependents_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get dependents from a task # noqa: E501 + + Returns the compact representations of all of the dependents of a task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dependents_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_dependents_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_dependents_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_dependents_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get dependents from a task # noqa: E501 + + Returns the compact representations of all of the dependents of a task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dependents_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_dependents_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_dependents_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/dependents', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/dependents', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/dependents', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_subtasks_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get subtasks from a task # noqa: E501 + + Returns a compact representation of all of the subtasks of a task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_subtasks_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_subtasks_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_subtasks_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_subtasks_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get subtasks from a task # noqa: E501 + + Returns a compact representation of all of the subtasks of a task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_subtasks_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_subtasks_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_subtasks_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/subtasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/subtasks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/subtasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get a task # noqa: E501 + + Returns the complete task record for a single task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get a task # noqa: E501 + + Returns the complete task record for a single task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tasks(self, opts, **kwargs): # noqa: E501 + """Get multiple tasks # noqa: E501 + + Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`. For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/reference/searchtasksforworkspace). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str assignee: The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.* + :param str project: The project to filter tasks on. + :param str section: The section to filter tasks on. + :param str workspace: The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.* + :param datetime completed_since: Only return tasks that are either incomplete or that have been completed since this time. + :param datetime modified_since: Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.* + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tasks_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tasks_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_tasks_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple tasks # noqa: E501 + + Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`. For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/reference/searchtasksforworkspace). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str assignee: The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.* + :param str project: The project to filter tasks on. + :param str section: The section to filter tasks on. + :param str workspace: The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.* + :param datetime completed_since: Only return tasks that are either incomplete or that have been completed since this time. + :param datetime modified_since: Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.* + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tasks" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tasks_for_project(self, project_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a project # noqa: E501 + + Returns the compact task records for all tasks within the given project, ordered by their priority within the project. Tasks can exist in more than one project at a time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_project(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tasks_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tasks_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tasks_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a project # noqa: E501 + + Returns the compact task records for all tasks within the given project, ordered by their priority within the project. Tasks can exist in more than one project at a time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_project_with_http_info(project_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str project_gid: Globally unique identifier for the project. (required) + :param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tasks_for_project" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'project_gid' is set + if (project_gid is None): + raise ValueError("Missing the required parameter `project_gid` when calling `get_tasks_for_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['project_gid'] = project_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/projects/{project_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/projects/{project_gid}/tasks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/projects/{project_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tasks_for_section(self, section_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a section # noqa: E501 + + *Board view only*: Returns the compact section records for all tasks within the given section. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_section(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tasks_for_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tasks_for_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tasks_for_section_with_http_info(self, section_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a section # noqa: E501 + + *Board view only*: Returns the compact section records for all tasks within the given section. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_section_with_http_info(section_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str section_gid: The globally unique identifier for the section. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tasks_for_section" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'section_gid' is set + if (section_gid is None): + raise ValueError("Missing the required parameter `section_gid` when calling `get_tasks_for_section`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['section_gid'] = section_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/sections/{section_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/sections/{section_gid}/tasks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/sections/{section_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tasks_for_tag(self, tag_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a tag # noqa: E501 + + Returns the compact task records for all tasks with the given tag. Tasks can have more than one tag at a time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_tag(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tasks_for_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tasks_for_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tasks_for_tag_with_http_info(self, tag_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a tag # noqa: E501 + + Returns the compact task records for all tasks with the given tag. Tasks can have more than one tag at a time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_tag_with_http_info(tag_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tag_gid: Globally unique identifier for the tag. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tasks_for_tag" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tag_gid' is set + if (tag_gid is None): + raise ValueError("Missing the required parameter `tag_gid` when calling `get_tasks_for_tag`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['tag_gid'] = tag_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tags/{tag_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tags/{tag_gid}/tasks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tags/{tag_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tasks_for_user_task_list(self, user_task_list_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a user task list # noqa: E501 + + Returns the compact list of tasks in a user’s My Tasks list. *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_user_task_list(user_task_list_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_task_list_gid: Globally unique identifier for the user task list. (required) + :param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_tasks_for_user_task_list_with_http_info(user_task_list_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_tasks_for_user_task_list_with_http_info(user_task_list_gid, opts, **kwargs) # noqa: E501 + return data + + def get_tasks_for_user_task_list_with_http_info(self, user_task_list_gid, opts, **kwargs): # noqa: E501 + """Get tasks from a user task list # noqa: E501 + + Returns the compact list of tasks in a user’s My Tasks list. *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tasks_for_user_task_list_with_http_info(user_task_list_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_task_list_gid: Globally unique identifier for the user task list. (required) + :param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tasks_for_user_task_list" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_task_list_gid' is set + if (user_task_list_gid is None): + raise ValueError("Missing the required parameter `user_task_list_gid` when calling `get_tasks_for_user_task_list`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_task_list_gid'] = user_task_list_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/user_task_lists/{user_task_list_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/user_task_lists/{user_task_list_gid}/tasks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/user_task_lists/{user_task_list_gid}/tasks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_dependencies_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Unlink dependencies from a task # noqa: E501 + + Unlinks a set of dependencies from this task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_dependencies_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to unlink as dependencies. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_dependencies_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_dependencies_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def remove_dependencies_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Unlink dependencies from a task # noqa: E501 + + Unlinks a set of dependencies from this task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_dependencies_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to unlink as dependencies. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_dependencies_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_dependencies_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `remove_dependencies_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/removeDependencies', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/removeDependencies', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/removeDependencies', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_dependents_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Unlink dependents from a task # noqa: E501 + + Unlinks a set of dependents from this task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_dependents_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to remove as dependents. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_dependents_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_dependents_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def remove_dependents_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Unlink dependents from a task # noqa: E501 + + Unlinks a set of dependents from this task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_dependents_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The list of tasks to remove as dependents. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_dependents_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_dependents_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `remove_dependents_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/removeDependents', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/removeDependents', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/removeDependents', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_follower_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Remove followers from a task # noqa: E501 + + Removes each of the specified followers from the task if they are following. Returns the complete, updated record for the affected task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_follower_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to remove from the task. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_follower_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.remove_follower_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def remove_follower_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Remove followers from a task # noqa: E501 + + Removes each of the specified followers from the task if they are following. Returns the complete, updated record for the affected task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_follower_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The followers to remove from the task. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_follower_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_follower_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `remove_follower_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/removeFollowers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_project_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Remove a project from a task # noqa: E501 + + Removes the task from the specified project. The task will still exist in the system, but it will not be in the project anymore. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_project_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project to remove the task from. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_project_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_project_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def remove_project_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Remove a project from a task # noqa: E501 + + Removes the task from the specified project. The task will still exist in the system, but it will not be in the project anymore. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_project_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The project to remove the task from. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_project_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_project_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `remove_project_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/removeProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/removeProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/removeProject', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_tag_for_task(self, body, task_gid, **kwargs): # noqa: E501 + """Remove a tag from a task # noqa: E501 + + Removes a tag from a task. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_tag_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to remove from the task. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_tag_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_tag_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501 + return data + + def remove_tag_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501 + """Remove a tag from a task # noqa: E501 + + Removes a tag from a task. Returns an empty data block. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_tag_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The tag to remove from the task. (required) + :param str task_gid: The task to operate on. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_tag_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_tag_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `remove_tag_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/removeTag', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/removeTag', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/removeTag', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 search_tasks_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Search tasks in a workspace # noqa: E501 + + To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need. #### Premium access Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true: - The workspace in which the search is being performed is a premium workspace - The user is a member of a premium team inside the workspace Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a `402 Payment Required` error. #### Pagination Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional [pagination](https://developers.asana.com/docs/#pagination) available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the `limit` query parameter. #### Eventual consistency Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product. #### Rate limits You may receive a `429 Too Many Requests` response if you hit any of our [rate limits](https://developers.asana.com/docs/#rate-limits). #### Custom field parameters | Parameter name | Custom field type | Accepted type | |---|---|---| | custom_fields.{gid}.is_set | All | Boolean | | custom_fields.{gid}.value | Text | String | | custom_fields.{gid}.value | Number | Number | | custom_fields.{gid}.value | Enum | Enum option ID | | custom_fields.{gid}.starts_with | Text only | String | | custom_fields.{gid}.ends_with | Text only | String | | custom_fields.{gid}.contains | Text only | String | | custom_fields.{gid}.less_than | Number only | Number | | custom_fields.{gid}.greater_than | Number only | Number | For example, if the gid of the custom field is 12345, these query parameter to find tasks where it is set would be `custom_fields.12345.is_set=true`. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: `custom_fields.12345.value=67890`. **Not Supported**: searching for multiple exact matches of a custom field, searching for multi-enum custom field *Note: If you specify `projects.any` and `sections.any`, you will receive tasks for the project **and** tasks for the section. If you're looking for only tasks in a section, omit the `projects.any` from the request.* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.search_tasks_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str text: Performs full-text search on both task name and description + :param str resource_subtype: Filters results by the task's resource_subtype + :param str assignee.any: Comma-separated list of user identifiers + :param str assignee.not: Comma-separated list of user identifiers + :param str portfolios.any: Comma-separated list of portfolio IDs + :param str projects.any: Comma-separated list of project IDs + :param str projects.not: Comma-separated list of project IDs + :param str projects.all: Comma-separated list of project IDs + :param str sections.any: Comma-separated list of section or column IDs + :param str sections.not: Comma-separated list of section or column IDs + :param str sections.all: Comma-separated list of section or column IDs + :param str tags.any: Comma-separated list of tag IDs + :param str tags.not: Comma-separated list of tag IDs + :param str tags.all: Comma-separated list of tag IDs + :param str teams.any: Comma-separated list of team IDs + :param str followers.not: Comma-separated list of user identifiers + :param str created_by.any: Comma-separated list of user identifiers + :param str created_by.not: Comma-separated list of user identifiers + :param str assigned_by.any: Comma-separated list of user identifiers + :param str assigned_by.not: Comma-separated list of user identifiers + :param str liked_by.not: Comma-separated list of user identifiers + :param str commented_on_by.not: Comma-separated list of user identifiers + :param date due_on.before: ISO 8601 date string + :param date due_on.after: ISO 8601 date string + :param date due_on: ISO 8601 date string or `null` + :param datetime due_at.before: ISO 8601 datetime string + :param datetime due_at.after: ISO 8601 datetime string + :param date start_on.before: ISO 8601 date string + :param date start_on.after: ISO 8601 date string + :param date start_on: ISO 8601 date string or `null` + :param date created_on.before: ISO 8601 date string + :param date created_on.after: ISO 8601 date string + :param date created_on: ISO 8601 date string or `null` + :param datetime created_at.before: ISO 8601 datetime string + :param datetime created_at.after: ISO 8601 datetime string + :param date completed_on.before: ISO 8601 date string + :param date completed_on.after: ISO 8601 date string + :param date completed_on: ISO 8601 date string or `null` + :param datetime completed_at.before: ISO 8601 datetime string + :param datetime completed_at.after: ISO 8601 datetime string + :param date modified_on.before: ISO 8601 date string + :param date modified_on.after: ISO 8601 date string + :param date modified_on: ISO 8601 date string or `null` + :param datetime modified_at.before: ISO 8601 datetime string + :param datetime modified_at.after: ISO 8601 datetime string + :param bool is_blocking: Filter to incomplete tasks with dependents + :param bool is_blocked: Filter to tasks with incomplete dependencies + :param bool has_attachment: Filter to tasks with attachments + :param bool completed: Filter to completed tasks + :param bool is_subtask: Filter to subtasks + :param str sort_by: One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at` + :param bool sort_ascending: Default `false` + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.search_tasks_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.search_tasks_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def search_tasks_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Search tasks in a workspace # noqa: E501 + + To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need. #### Premium access Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true: - The workspace in which the search is being performed is a premium workspace - The user is a member of a premium team inside the workspace Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a `402 Payment Required` error. #### Pagination Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional [pagination](https://developers.asana.com/docs/#pagination) available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the `limit` query parameter. #### Eventual consistency Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product. #### Rate limits You may receive a `429 Too Many Requests` response if you hit any of our [rate limits](https://developers.asana.com/docs/#rate-limits). #### Custom field parameters | Parameter name | Custom field type | Accepted type | |---|---|---| | custom_fields.{gid}.is_set | All | Boolean | | custom_fields.{gid}.value | Text | String | | custom_fields.{gid}.value | Number | Number | | custom_fields.{gid}.value | Enum | Enum option ID | | custom_fields.{gid}.starts_with | Text only | String | | custom_fields.{gid}.ends_with | Text only | String | | custom_fields.{gid}.contains | Text only | String | | custom_fields.{gid}.less_than | Number only | Number | | custom_fields.{gid}.greater_than | Number only | Number | For example, if the gid of the custom field is 12345, these query parameter to find tasks where it is set would be `custom_fields.12345.is_set=true`. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: `custom_fields.12345.value=67890`. **Not Supported**: searching for multiple exact matches of a custom field, searching for multi-enum custom field *Note: If you specify `projects.any` and `sections.any`, you will receive tasks for the project **and** tasks for the section. If you're looking for only tasks in a section, omit the `projects.any` from the request.* # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.search_tasks_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str text: Performs full-text search on both task name and description + :param str resource_subtype: Filters results by the task's resource_subtype + :param str assignee.any: Comma-separated list of user identifiers + :param str assignee.not: Comma-separated list of user identifiers + :param str portfolios.any: Comma-separated list of portfolio IDs + :param str projects.any: Comma-separated list of project IDs + :param str projects.not: Comma-separated list of project IDs + :param str projects.all: Comma-separated list of project IDs + :param str sections.any: Comma-separated list of section or column IDs + :param str sections.not: Comma-separated list of section or column IDs + :param str sections.all: Comma-separated list of section or column IDs + :param str tags.any: Comma-separated list of tag IDs + :param str tags.not: Comma-separated list of tag IDs + :param str tags.all: Comma-separated list of tag IDs + :param str teams.any: Comma-separated list of team IDs + :param str followers.not: Comma-separated list of user identifiers + :param str created_by.any: Comma-separated list of user identifiers + :param str created_by.not: Comma-separated list of user identifiers + :param str assigned_by.any: Comma-separated list of user identifiers + :param str assigned_by.not: Comma-separated list of user identifiers + :param str liked_by.not: Comma-separated list of user identifiers + :param str commented_on_by.not: Comma-separated list of user identifiers + :param date due_on.before: ISO 8601 date string + :param date due_on.after: ISO 8601 date string + :param date due_on: ISO 8601 date string or `null` + :param datetime due_at.before: ISO 8601 datetime string + :param datetime due_at.after: ISO 8601 datetime string + :param date start_on.before: ISO 8601 date string + :param date start_on.after: ISO 8601 date string + :param date start_on: ISO 8601 date string or `null` + :param date created_on.before: ISO 8601 date string + :param date created_on.after: ISO 8601 date string + :param date created_on: ISO 8601 date string or `null` + :param datetime created_at.before: ISO 8601 datetime string + :param datetime created_at.after: ISO 8601 datetime string + :param date completed_on.before: ISO 8601 date string + :param date completed_on.after: ISO 8601 date string + :param date completed_on: ISO 8601 date string or `null` + :param datetime completed_at.before: ISO 8601 datetime string + :param datetime completed_at.after: ISO 8601 datetime string + :param date modified_on.before: ISO 8601 date string + :param date modified_on.after: ISO 8601 date string + :param date modified_on: ISO 8601 date string or `null` + :param datetime modified_at.before: ISO 8601 datetime string + :param datetime modified_at.after: ISO 8601 datetime string + :param bool is_blocking: Filter to incomplete tasks with dependents + :param bool is_blocked: Filter to tasks with incomplete dependencies + :param bool has_attachment: Filter to tasks with attachments + :param bool completed: Filter to completed tasks + :param bool is_subtask: Filter to subtasks + :param str sort_by: One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at` + :param bool sort_ascending: Default `false` + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + params = locals() + matchSnakeCase = '^custom_fields_(.*?)_.*$' + custom_fields_query_param_keys = [] + for key, val in six.iteritems(params['kwargs']): + # Do not throw an error if the user provides custom field query parameters + if (re.match(matchSnakeCase, key)): + custom_field_gid = re.search(matchSnakeCase, key).group(1) + custom_field_query_param_key = key.replace(f'custom_fields_{custom_field_gid}_', f'custom_fields.{custom_field_gid}.') + params[custom_field_query_param_key] = val + custom_fields_query_param_keys.append(custom_field_query_param_key) + continue + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method search_tasks_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `search_tasks_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + # Checks if the user provided custom field query parameters and adds it to the request + for key in custom_fields_query_param_keys: + query_params[key] = params[key] # noqa: E501 + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/tasks/search', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/tasks/search', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/tasks/search', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 set_parent_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Set the parent of a task # noqa: E501 + + parent, or no parent task at all. Returns an empty data block. When using `insert_before` and `insert_after`, at most one of those two options can be specified, and they must already be subtasks of the parent. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_parent_for_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new parent of the subtask. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.set_parent_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.set_parent_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def set_parent_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Set the parent of a task # noqa: E501 + + parent, or no parent task at all. Returns an empty data block. When using `insert_before` and `insert_after`, at most one of those two options can be specified, and they must already be subtasks of the parent. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_parent_for_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The new parent of the subtask. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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 set_parent_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `set_parent_for_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `set_parent_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/setParent', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/setParent', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/setParent', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_task(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Update a task # noqa: E501 + + A specific, existing task can be updated by making a PUT request on the URL for that task. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated task record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_task(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The task to update. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def update_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Update a task # noqa: E501 + + A specific, existing task can be updated by making a PUT request on the URL for that task. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated task record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_task_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The task to update. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TaskResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_task`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `update_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/team_memberships_api.py b/asana/api/team_memberships_api.py new file mode 100644 index 00000000..ba1c33c1 --- /dev/null +++ b/asana/api/team_memberships_api.py @@ -0,0 +1,616 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TeamMembershipsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_team_membership(self, team_membership_gid, opts, **kwargs): # noqa: E501 + """Get a team membership # noqa: E501 + + Returns the complete team membership record for a single team membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_membership(team_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_team_membership_with_http_info(team_membership_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_team_membership_with_http_info(team_membership_gid, opts, **kwargs) # noqa: E501 + return data + + def get_team_membership_with_http_info(self, team_membership_gid, opts, **kwargs): # noqa: E501 + """Get a team membership # noqa: E501 + + Returns the complete team membership record for a single team membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_membership_with_http_info(team_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_team_membership" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'team_membership_gid' is set + if (team_membership_gid is None): + raise ValueError("Missing the required parameter `team_membership_gid` when calling `get_team_membership`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_membership_gid'] = team_membership_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/team_memberships/{team_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/team_memberships/{team_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/team_memberships/{team_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_team_memberships(self, opts, **kwargs): # noqa: E501 + """Get team memberships # noqa: E501 + + Returns compact team membership records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_memberships(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str team: Globally unique identifier for the team. + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter. + :param str workspace: Globally unique identifier for the workspace. This parameter must be used with the user parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_team_memberships_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_team_memberships_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_team_memberships_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get team memberships # noqa: E501 + + Returns compact team membership records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_memberships_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str team: Globally unique identifier for the team. + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter. + :param str workspace: Globally unique identifier for the workspace. This parameter must be used with the user parameter. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_team_memberships" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/team_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/team_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/team_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_team_memberships_for_team(self, team_gid, opts, **kwargs): # noqa: E501 + """Get memberships from a team # noqa: E501 + + Returns the compact team memberships for the team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_memberships_for_team(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_team_memberships_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_team_memberships_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + return data + + def get_team_memberships_for_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501 + """Get memberships from a team # noqa: E501 + + Returns the compact team memberships for the team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_memberships_for_team_with_http_info(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_team_memberships_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `get_team_memberships_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/team_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/teams/{team_gid}/team_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/teams/{team_gid}/team_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_team_memberships_for_user(self, user_gid, workspace, opts, **kwargs): # noqa: E501 + """Get memberships from a user # noqa: E501 + + Returns the compact team membership records for the user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_memberships_for_user(user_gid, workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str workspace: Globally unique identifier for the workspace. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_team_memberships_for_user_with_http_info(user_gid, workspace, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_team_memberships_for_user_with_http_info(user_gid, workspace, opts, **kwargs) # noqa: E501 + return data + + def get_team_memberships_for_user_with_http_info(self, user_gid, workspace, opts, **kwargs): # noqa: E501 + """Get memberships from a user # noqa: E501 + + Returns the compact team membership records for the user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_memberships_for_user_with_http_info(user_gid, workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str workspace: Globally unique identifier for the workspace. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_team_memberships_for_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_gid' is set + if (user_gid is None): + raise ValueError("Missing the required parameter `user_gid` when calling `get_team_memberships_for_user`") # noqa: E501 + # verify the required parameter 'workspace' is set + if (workspace is None): + raise ValueError("Missing the required parameter `workspace` when calling `get_team_memberships_for_user`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_gid'] = user_gid # noqa: E501 + + query_params = [] + query_params = opts + query_params['workspace'] = workspace + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users/{user_gid}/team_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/users/{user_gid}/team_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/users/{user_gid}/team_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/teams_api.py b/asana/api/teams_api.py new file mode 100644 index 00000000..0392c9cd --- /dev/null +++ b/asana/api/teams_api.py @@ -0,0 +1,1053 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TeamsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_user_for_team(self, body, team_gid, opts, **kwargs): # noqa: E501 + """Add a user to a team # noqa: E501 + + The user making this call must be a member of the team in order to add others. The user being added must exist in the same organization as the team. Returns the complete team membership record for the newly added user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_user_for_team(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to add to the team. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_user_for_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_user_for_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501 + return data + + def add_user_for_team_with_http_info(self, body, team_gid, opts, **kwargs): # noqa: E501 + """Add a user to a team # noqa: E501 + + The user making this call must be a member of the team in order to add others. The user being added must exist in the same organization as the team. Returns the complete team membership record for the newly added user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_user_for_team_with_http_info(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to add to the team. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_user_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_user_for_team`") # noqa: E501 + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `add_user_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/addUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/teams/{team_gid}/addUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/teams/{team_gid}/addUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_team(self, body, opts, **kwargs): # noqa: E501 + """Create a team # noqa: E501 + + Creates a team within the current workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_team(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The team to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_team_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_team_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_team_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Create a team # noqa: E501 + + Creates a team within the current workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_team_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The team to create. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/teams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/teams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_team(self, team_gid, opts, **kwargs): # noqa: E501 + """Get a team # noqa: E501 + + Returns the full record for a single team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + return data + + def get_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501 + """Get a team # noqa: E501 + + Returns the full record for a single team. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_team_with_http_info(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `get_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/teams/{team_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/teams/{team_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_teams_for_user(self, user_gid, organization, opts, **kwargs): # noqa: E501 + """Get teams for a user # noqa: E501 + + Returns the compact records for all teams to which the given user is assigned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_teams_for_user(user_gid, organization, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str organization: The workspace or organization to filter teams on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_teams_for_user_with_http_info(user_gid, organization, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_teams_for_user_with_http_info(user_gid, organization, opts, **kwargs) # noqa: E501 + return data + + def get_teams_for_user_with_http_info(self, user_gid, organization, opts, **kwargs): # noqa: E501 + """Get teams for a user # noqa: E501 + + Returns the compact records for all teams to which the given user is assigned. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_teams_for_user_with_http_info(user_gid, organization, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str organization: The workspace or organization to filter teams on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_teams_for_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_gid' is set + if (user_gid is None): + raise ValueError("Missing the required parameter `user_gid` when calling `get_teams_for_user`") # noqa: E501 + # verify the required parameter 'organization' is set + if (organization is None): + raise ValueError("Missing the required parameter `organization` when calling `get_teams_for_user`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_gid'] = user_gid # noqa: E501 + + query_params = [] + query_params = opts + query_params['organization'] = organization + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users/{user_gid}/teams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/users/{user_gid}/teams', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/users/{user_gid}/teams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_teams_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get teams in a workspace # noqa: E501 + + Returns the compact records for all teams in the workspace visible to the authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_teams_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_teams_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_teams_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_teams_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get teams in a workspace # noqa: E501 + + Returns the compact records for all teams in the workspace visible to the authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_teams_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_teams_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_teams_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/teams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/teams', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/teams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_user_for_team(self, body, team_gid, **kwargs): # noqa: E501 + """Remove a user from a team # noqa: E501 + + The user making this call must be a member of the team in order to remove themselves or others. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_user_for_team(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to remove from the team. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_user_for_team_with_http_info(body, team_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_user_for_team_with_http_info(body, team_gid, **kwargs) # noqa: E501 + return data + + def remove_user_for_team_with_http_info(self, body, team_gid, **kwargs): # noqa: E501 + """Remove a user from a team # noqa: E501 + + The user making this call must be a member of the team in order to remove themselves or others. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_user_for_team_with_http_info(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to remove from the team. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_user_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_user_for_team`") # noqa: E501 + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `remove_user_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/removeUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/teams/{team_gid}/removeUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/teams/{team_gid}/removeUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_team(self, body, team_gid, opts, **kwargs): # noqa: E501 + """Update a team # noqa: E501 + + Updates a team within the current workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_team(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The team to update. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501 + return data + + def update_team_with_http_info(self, body, team_gid, opts, **kwargs): # noqa: E501 + """Update a team # noqa: E501 + + Updates a team within the current workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_team_with_http_info(body, team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The team to update. (required) + :param str team_gid: Globally unique identifier for the team. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TeamResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_team`") # noqa: E501 + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `update_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/teams/{team_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/teams/{team_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/time_periods_api.py b/asana/api/time_periods_api.py new file mode 100644 index 00000000..eafe2d99 --- /dev/null +++ b/asana/api/time_periods_api.py @@ -0,0 +1,322 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TimePeriodsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_time_period(self, time_period_gid, opts, **kwargs): # noqa: E501 + """Get a time period # noqa: E501 + + Returns the full record for a single time period. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_period(time_period_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str time_period_gid: Globally unique identifier for the time period. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimePeriodResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_time_period_with_http_info(time_period_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_time_period_with_http_info(time_period_gid, opts, **kwargs) # noqa: E501 + return data + + def get_time_period_with_http_info(self, time_period_gid, opts, **kwargs): # noqa: E501 + """Get a time period # noqa: E501 + + Returns the full record for a single time period. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_period_with_http_info(time_period_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str time_period_gid: Globally unique identifier for the time period. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimePeriodResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_time_period" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'time_period_gid' is set + if (time_period_gid is None): + raise ValueError("Missing the required parameter `time_period_gid` when calling `get_time_period`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['time_period_gid'] = time_period_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/time_periods/{time_period_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/time_periods/{time_period_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/time_periods/{time_period_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_time_periods(self, workspace, opts, **kwargs): # noqa: E501 + """Get time periods # noqa: E501 + + Returns compact time period records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_periods(workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: Globally unique identifier for the workspace. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param date start_on: ISO 8601 date string + :param date end_on: ISO 8601 date string + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimePeriodResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_time_periods_with_http_info(workspace, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_time_periods_with_http_info(workspace, opts, **kwargs) # noqa: E501 + return data + + def get_time_periods_with_http_info(self, workspace, opts, **kwargs): # noqa: E501 + """Get time periods # noqa: E501 + + Returns compact time period records. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_periods_with_http_info(workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: Globally unique identifier for the workspace. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param date start_on: ISO 8601 date string + :param date end_on: ISO 8601 date string + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimePeriodResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_time_periods" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace' is set + if (workspace is None): + raise ValueError("Missing the required parameter `workspace` when calling `get_time_periods`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['workspace'] = workspace + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/time_periods', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/time_periods', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/time_periods', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/time_tracking_entries_api.py b/asana/api/time_tracking_entries_api.py new file mode 100644 index 00000000..5f1b0298 --- /dev/null +++ b/asana/api/time_tracking_entries_api.py @@ -0,0 +1,750 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TimeTrackingEntriesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_time_tracking_entry(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Create a time tracking entry # noqa: E501 + + Creates a time tracking entry on a given task. Returns the record of the newly created time tracking entry. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_time_tracking_entry(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the time tracking entry. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryBaseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_time_tracking_entry_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_time_tracking_entry_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501 + return data + + def create_time_tracking_entry_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501 + """Create a time tracking entry # noqa: E501 + + Creates a time tracking entry on a given task. Returns the record of the newly created time tracking entry. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_time_tracking_entry_with_http_info(body, task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: Information about the time tracking entry. (required) + :param str task_gid: The task to operate on. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryBaseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_time_tracking_entry" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_time_tracking_entry`") # noqa: E501 + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `create_time_tracking_entry`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/time_tracking_entries', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/tasks/{task_gid}/time_tracking_entries', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/tasks/{task_gid}/time_tracking_entries', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_time_tracking_entry(self, time_tracking_entry_gid, **kwargs): # noqa: E501 + """Delete a time tracking entry # noqa: E501 + + A specific, existing time tracking entry can be deleted by making a `DELETE` request on the URL for that time tracking entry. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_time_tracking_entry(time_tracking_entry_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_time_tracking_entry_with_http_info(time_tracking_entry_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_time_tracking_entry_with_http_info(time_tracking_entry_gid, **kwargs) # noqa: E501 + return data + + def delete_time_tracking_entry_with_http_info(self, time_tracking_entry_gid, **kwargs): # noqa: E501 + """Delete a time tracking entry # noqa: E501 + + A specific, existing time tracking entry can be deleted by making a `DELETE` request on the URL for that time tracking entry. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_time_tracking_entry_with_http_info(time_tracking_entry_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_time_tracking_entry" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'time_tracking_entry_gid' is set + if (time_tracking_entry_gid is None): + raise ValueError("Missing the required parameter `time_tracking_entry_gid` when calling `delete_time_tracking_entry`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['time_tracking_entry_gid'] = time_tracking_entry_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_time_tracking_entries_for_task(self, task_gid, opts, **kwargs): # noqa: E501 + """Get time tracking entries for a task # noqa: E501 + + Returns time tracking entries for a given task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_tracking_entries_for_task(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryCompactArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_time_tracking_entries_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_time_tracking_entries_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501 + return data + + def get_time_tracking_entries_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501 + """Get time tracking entries for a task # noqa: E501 + + Returns time tracking entries for a given task. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_tracking_entries_for_task_with_http_info(task_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str task_gid: The task to operate on. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryCompactArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_time_tracking_entries_for_task" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'task_gid' is set + if (task_gid is None): + raise ValueError("Missing the required parameter `task_gid` when calling `get_time_tracking_entries_for_task`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['task_gid'] = task_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/tasks/{task_gid}/time_tracking_entries', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/tasks/{task_gid}/time_tracking_entries', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/tasks/{task_gid}/time_tracking_entries', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_time_tracking_entry(self, time_tracking_entry_gid, opts, **kwargs): # noqa: E501 + """Get a time tracking entry # noqa: E501 + + Returns the complete time tracking entry record for a single time tracking entry. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_tracking_entry(time_tracking_entry_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryBaseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_time_tracking_entry_with_http_info(time_tracking_entry_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_time_tracking_entry_with_http_info(time_tracking_entry_gid, opts, **kwargs) # noqa: E501 + return data + + def get_time_tracking_entry_with_http_info(self, time_tracking_entry_gid, opts, **kwargs): # noqa: E501 + """Get a time tracking entry # noqa: E501 + + Returns the complete time tracking entry record for a single time tracking entry. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_time_tracking_entry_with_http_info(time_tracking_entry_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryBaseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_time_tracking_entry" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'time_tracking_entry_gid' is set + if (time_tracking_entry_gid is None): + raise ValueError("Missing the required parameter `time_tracking_entry_gid` when calling `get_time_tracking_entry`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['time_tracking_entry_gid'] = time_tracking_entry_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_time_tracking_entry(self, body, time_tracking_entry_gid, opts, **kwargs): # noqa: E501 + """Update a time tracking entry # noqa: E501 + + A specific, existing time tracking entry can be updated by making a `PUT` request on the URL for that time tracking entry. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated time tracking entry record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_time_tracking_entry(body, time_tracking_entry_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the time tracking entry. (required) + :param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryBaseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_time_tracking_entry_with_http_info(body, time_tracking_entry_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_time_tracking_entry_with_http_info(body, time_tracking_entry_gid, opts, **kwargs) # noqa: E501 + return data + + def update_time_tracking_entry_with_http_info(self, body, time_tracking_entry_gid, opts, **kwargs): # noqa: E501 + """Update a time tracking entry # noqa: E501 + + A specific, existing time tracking entry can be updated by making a `PUT` request on the URL for that time tracking entry. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated time tracking entry record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_time_tracking_entry_with_http_info(body, time_tracking_entry_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated fields for the time tracking entry. (required) + :param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: TimeTrackingEntryBaseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_time_tracking_entry" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_time_tracking_entry`") # noqa: E501 + # verify the required parameter 'time_tracking_entry_gid' is set + if (time_tracking_entry_gid is None): + raise ValueError("Missing the required parameter `time_tracking_entry_gid` when calling `update_time_tracking_entry`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['time_tracking_entry_gid'] = time_tracking_entry_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/time_tracking_entries/{time_tracking_entry_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/typeahead_api.py b/asana/api/typeahead_api.py new file mode 100644 index 00000000..d37e0cf9 --- /dev/null +++ b/asana/api/typeahead_api.py @@ -0,0 +1,187 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class TypeaheadApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def typeahead_for_workspace(self, workspace_gid, resource_type, opts, **kwargs): # noqa: E501 + """Get objects via typeahead # noqa: E501 + + Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type `user` are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, messages, etc. Resources with type `project` are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type `task` are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Resources with type `project_template` are returned with priority placed on favorited project templates. Leaving the `query` string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.typeahead_for_workspace(workspace_gid, resource_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str resource_type: The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `project`, `project_template`, `portfolio`, `tag`, `task`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported. (required) + :param str type: *Deprecated: new integrations should prefer the resource_type field.* + :param str query: The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results. + :param int count: The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AsanaNamedResourceArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.typeahead_for_workspace_with_http_info(workspace_gid, resource_type, opts, **kwargs) # noqa: E501 + else: + (data) = self.typeahead_for_workspace_with_http_info(workspace_gid, resource_type, opts, **kwargs) # noqa: E501 + return data + + def typeahead_for_workspace_with_http_info(self, workspace_gid, resource_type, opts, **kwargs): # noqa: E501 + """Get objects via typeahead # noqa: E501 + + Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type `user` are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, messages, etc. Resources with type `project` are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type `task` are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Resources with type `project_template` are returned with priority placed on favorited project templates. Leaving the `query` string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.typeahead_for_workspace_with_http_info(workspace_gid, resource_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str resource_type: The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `project`, `project_template`, `portfolio`, `tag`, `task`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported. (required) + :param str type: *Deprecated: new integrations should prefer the resource_type field.* + :param str query: The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results. + :param int count: The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AsanaNamedResourceArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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 typeahead_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `typeahead_for_workspace`") # noqa: E501 + # verify the required parameter 'resource_type' is set + if (resource_type is None): + raise ValueError("Missing the required parameter `resource_type` when calling `typeahead_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + query_params['resource_type'] = resource_type + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/typeahead', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/typeahead', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/typeahead', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/user_task_lists_api.py b/asana/api/user_task_lists_api.py new file mode 100644 index 00000000..117ba91a --- /dev/null +++ b/asana/api/user_task_lists_api.py @@ -0,0 +1,317 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class UserTaskListsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_user_task_list(self, user_task_list_gid, opts, **kwargs): # noqa: E501 + """Get a user task list # noqa: E501 + + Returns the full record for a user task list. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_task_list(user_task_list_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_task_list_gid: Globally unique identifier for the user task list. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserTaskListResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_user_task_list_with_http_info(user_task_list_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_user_task_list_with_http_info(user_task_list_gid, opts, **kwargs) # noqa: E501 + return data + + def get_user_task_list_with_http_info(self, user_task_list_gid, opts, **kwargs): # noqa: E501 + """Get a user task list # noqa: E501 + + Returns the full record for a user task list. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_task_list_with_http_info(user_task_list_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_task_list_gid: Globally unique identifier for the user task list. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserTaskListResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_task_list" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_task_list_gid' is set + if (user_task_list_gid is None): + raise ValueError("Missing the required parameter `user_task_list_gid` when calling `get_user_task_list`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_task_list_gid'] = user_task_list_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/user_task_lists/{user_task_list_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/user_task_lists/{user_task_list_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/user_task_lists/{user_task_list_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_task_list_for_user(self, user_gid, workspace, opts, **kwargs): # noqa: E501 + """Get a user's task list # noqa: E501 + + Returns the full record for a user's task list. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_task_list_for_user(user_gid, workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str workspace: The workspace in which to get the user task list. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserTaskListResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_user_task_list_for_user_with_http_info(user_gid, workspace, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_user_task_list_for_user_with_http_info(user_gid, workspace, opts, **kwargs) # noqa: E501 + return data + + def get_user_task_list_for_user_with_http_info(self, user_gid, workspace, opts, **kwargs): # noqa: E501 + """Get a user's task list # noqa: E501 + + Returns the full record for a user's task list. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_task_list_for_user_with_http_info(user_gid, workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str workspace: The workspace in which to get the user task list. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserTaskListResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_task_list_for_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_gid' is set + if (user_gid is None): + raise ValueError("Missing the required parameter `user_gid` when calling `get_user_task_list_for_user`") # noqa: E501 + # verify the required parameter 'workspace' is set + if (workspace is None): + raise ValueError("Missing the required parameter `workspace` when calling `get_user_task_list_for_user`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_gid'] = user_gid # noqa: E501 + + query_params = [] + query_params = opts + query_params['workspace'] = workspace + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users/{user_gid}/user_task_list', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/users/{user_gid}/user_task_list', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/users/{user_gid}/user_task_list', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/users_api.py b/asana/api/users_api.py new file mode 100644 index 00000000..449f3f12 --- /dev/null +++ b/asana/api/users_api.py @@ -0,0 +1,762 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class UsersApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_favorites_for_user(self, user_gid, resource_type, workspace, opts, **kwargs): # noqa: E501 + """Get a user's favorites # noqa: E501 + + Returns all of a user's favorites in the given workspace, of the given type. Results are given in order (The same order as Asana's sidebar). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_favorites_for_user(user_gid, resource_type, workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str resource_type: The resource type of favorites to be returned. (required) + :param str workspace: The workspace in which to get favorites. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AsanaNamedResourceArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_favorites_for_user_with_http_info(user_gid, resource_type, workspace, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_favorites_for_user_with_http_info(user_gid, resource_type, workspace, opts, **kwargs) # noqa: E501 + return data + + def get_favorites_for_user_with_http_info(self, user_gid, resource_type, workspace, opts, **kwargs): # noqa: E501 + """Get a user's favorites # noqa: E501 + + Returns all of a user's favorites in the given workspace, of the given type. Results are given in order (The same order as Asana's sidebar). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_favorites_for_user_with_http_info(user_gid, resource_type, workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param str resource_type: The resource type of favorites to be returned. (required) + :param str workspace: The workspace in which to get favorites. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: AsanaNamedResourceArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_favorites_for_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_gid' is set + if (user_gid is None): + raise ValueError("Missing the required parameter `user_gid` when calling `get_favorites_for_user`") # noqa: E501 + # verify the required parameter 'resource_type' is set + if (resource_type is None): + raise ValueError("Missing the required parameter `resource_type` when calling `get_favorites_for_user`") # noqa: E501 + # verify the required parameter 'workspace' is set + if (workspace is None): + raise ValueError("Missing the required parameter `workspace` when calling `get_favorites_for_user`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_gid'] = user_gid # noqa: E501 + + query_params = [] + query_params = opts + query_params['resource_type'] = resource_type + query_params['workspace'] = workspace + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users/{user_gid}/favorites', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/users/{user_gid}/favorites', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/users/{user_gid}/favorites', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_gid, opts, **kwargs): # noqa: E501 + """Get a user # noqa: E501 + + Returns the full user record for the single user with the provided ID. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user(user_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_user_with_http_info(user_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_user_with_http_info(user_gid, opts, **kwargs) # noqa: E501 + return data + + def get_user_with_http_info(self, user_gid, opts, **kwargs): # noqa: E501 + """Get a user # noqa: E501 + + Returns the full user record for the single user with the provided ID. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_with_http_info(user_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_gid' is set + if (user_gid is None): + raise ValueError("Missing the required parameter `user_gid` when calling `get_user`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_gid'] = user_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users/{user_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/users/{user_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/users/{user_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_users(self, opts, **kwargs): # noqa: E501 + """Get multiple users # noqa: E501 + + Returns the user records for all users in all workspaces and organizations accessible to the authenticated user. Accepts an optional workspace ID parameter. Results are sorted by user ID. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace or organization ID to filter users on. + :param str team: The team ID to filter users on. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_users_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_users_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_users_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple users # noqa: E501 + + Returns the user records for all users in all workspaces and organizations accessible to the authenticated user. Accepts an optional workspace ID parameter. Results are sorted by user ID. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace or organization ID to filter users on. + :param str team: The team ID to filter users on. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_users" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/users', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/users', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_users_for_team(self, team_gid, opts, **kwargs): # noqa: E501 + """Get users in a team # noqa: E501 + + Returns the compact records for all users that are members of the team. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_team(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_users_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_users_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501 + return data + + def get_users_for_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501 + """Get users in a team # noqa: E501 + + Returns the compact records for all users that are members of the team. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_team_with_http_info(team_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str team_gid: Globally unique identifier for the team. (required) + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_users_for_team" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'team_gid' is set + if (team_gid is None): + raise ValueError("Missing the required parameter `team_gid` when calling `get_users_for_team`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['team_gid'] = team_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/teams/{team_gid}/users', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/teams/{team_gid}/users', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/teams/{team_gid}/users', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_users_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get users in a workspace or organization # noqa: E501 + + Returns the compact records for all users in the specified workspace or organization. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_users_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_users_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_users_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get users in a workspace or organization # noqa: E501 + + Returns the compact records for all users in the specified workspace or organization. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_users_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_users_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/users', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/users', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/users', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/webhooks_api.py b/asana/api/webhooks_api.py new file mode 100644 index 00000000..55cb1ccb --- /dev/null +++ b/asana/api/webhooks_api.py @@ -0,0 +1,746 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class WebhooksApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_webhook(self, body, opts, **kwargs): # noqa: E501 + """Establish a webhook # noqa: E501 + + Establishing a webhook is a two-part process. First, a simple HTTP POST request initiates the creation similar to creating any other resource. Next, in the middle of this request comes the confirmation handshake. When a webhook is created, we will send a test POST to the target with an `X-Hook-Secret` header. The target must respond with a `200 OK` or `204 No Content` and a matching `X-Hook-Secret` header to confirm that this webhook subscription is indeed expected. We strongly recommend storing this secret to be used to verify future webhook event signatures. The POST request to create the webhook will then return with the status of the request. If you do not acknowledge the webhook’s confirmation handshake it will fail to setup, and you will receive an error in response to your attempt to create it. This means you need to be able to receive and complete the webhook *while* the POST request is in-flight (in other words, have a server that can handle requests asynchronously). Invalid hostnames like localhost will recieve a 403 Forbidden status code. ``` # Request curl -H \"Authorization: Bearer \" \\ -X POST https://app.asana.com/api/1.0/webhooks \\ -d \"resource=8675309\" \\ -d \"target=https://example.com/receive-webhook/7654\" ``` ``` # Handshake sent to https://example.com/ POST /receive-webhook/7654 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Handshake response sent by example.com HTTP/1.1 200 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Response HTTP/1.1 201 { \"data\": { \"gid\": \"43214\", \"resource\": { \"gid\": \"8675309\", \"name\": \"Bugs\" }, \"target\": \"https://example.com/receive-webhook/7654\", \"active\": false, \"last_success_at\": null, \"last_failure_at\": null, \"last_failure_content\": null } } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_webhook(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The webhook workspace and target. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.create_webhook_with_http_info(body, opts, **kwargs) # noqa: E501 + else: + (data) = self.create_webhook_with_http_info(body, opts, **kwargs) # noqa: E501 + return data + + def create_webhook_with_http_info(self, body, opts, **kwargs): # noqa: E501 + """Establish a webhook # noqa: E501 + + Establishing a webhook is a two-part process. First, a simple HTTP POST request initiates the creation similar to creating any other resource. Next, in the middle of this request comes the confirmation handshake. When a webhook is created, we will send a test POST to the target with an `X-Hook-Secret` header. The target must respond with a `200 OK` or `204 No Content` and a matching `X-Hook-Secret` header to confirm that this webhook subscription is indeed expected. We strongly recommend storing this secret to be used to verify future webhook event signatures. The POST request to create the webhook will then return with the status of the request. If you do not acknowledge the webhook’s confirmation handshake it will fail to setup, and you will receive an error in response to your attempt to create it. This means you need to be able to receive and complete the webhook *while* the POST request is in-flight (in other words, have a server that can handle requests asynchronously). Invalid hostnames like localhost will recieve a 403 Forbidden status code. ``` # Request curl -H \"Authorization: Bearer \" \\ -X POST https://app.asana.com/api/1.0/webhooks \\ -d \"resource=8675309\" \\ -d \"target=https://example.com/receive-webhook/7654\" ``` ``` # Handshake sent to https://example.com/ POST /receive-webhook/7654 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Handshake response sent by example.com HTTP/1.1 200 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Response HTTP/1.1 201 { \"data\": { \"gid\": \"43214\", \"resource\": { \"gid\": \"8675309\", \"name\": \"Bugs\" }, \"target\": \"https://example.com/receive-webhook/7654\", \"active\": false, \"last_success_at\": null, \"last_failure_at\": null, \"last_failure_content\": null } } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_webhook_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The webhook workspace and target. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_webhook" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `create_webhook`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/webhooks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/webhooks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/webhooks', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_webhook(self, webhook_gid, **kwargs): # noqa: E501 + """Delete a webhook # noqa: E501 + + This method *permanently* removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_webhook(webhook_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str webhook_gid: Globally unique identifier for the webhook. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.delete_webhook_with_http_info(webhook_gid, **kwargs) # noqa: E501 + else: + (data) = self.delete_webhook_with_http_info(webhook_gid, **kwargs) # noqa: E501 + return data + + def delete_webhook_with_http_info(self, webhook_gid, **kwargs): # noqa: E501 + """Delete a webhook # noqa: E501 + + This method *permanently* removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_webhook_with_http_info(webhook_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str webhook_gid: Globally unique identifier for the webhook. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_webhook" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'webhook_gid' is set + if (webhook_gid is None): + raise ValueError("Missing the required parameter `webhook_gid` when calling `delete_webhook`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['webhook_gid'] = webhook_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/webhooks/{webhook_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/webhooks/{webhook_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/webhooks/{webhook_gid}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_webhook(self, webhook_gid, opts, **kwargs): # noqa: E501 + """Get a webhook # noqa: E501 + + Returns the full record for the given webhook. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_webhook(webhook_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str webhook_gid: Globally unique identifier for the webhook. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_webhook_with_http_info(webhook_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_webhook_with_http_info(webhook_gid, opts, **kwargs) # noqa: E501 + return data + + def get_webhook_with_http_info(self, webhook_gid, opts, **kwargs): # noqa: E501 + """Get a webhook # noqa: E501 + + Returns the full record for the given webhook. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_webhook_with_http_info(webhook_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str webhook_gid: Globally unique identifier for the webhook. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_webhook" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'webhook_gid' is set + if (webhook_gid is None): + raise ValueError("Missing the required parameter `webhook_gid` when calling `get_webhook`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['webhook_gid'] = webhook_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/webhooks/{webhook_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/webhooks/{webhook_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/webhooks/{webhook_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_webhooks(self, workspace, opts, **kwargs): # noqa: E501 + """Get multiple webhooks # noqa: E501 + + Get the compact representation of all webhooks your app has registered for the authenticated user in the given workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_webhooks(workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace to query for webhooks in. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str resource: Only return webhooks for the given resource. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_webhooks_with_http_info(workspace, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_webhooks_with_http_info(workspace, opts, **kwargs) # noqa: E501 + return data + + def get_webhooks_with_http_info(self, workspace, opts, **kwargs): # noqa: E501 + """Get multiple webhooks # noqa: E501 + + Get the compact representation of all webhooks your app has registered for the authenticated user in the given workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_webhooks_with_http_info(workspace, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace: The workspace to query for webhooks in. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param str resource: Only return webhooks for the given resource. + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_webhooks" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace' is set + if (workspace is None): + raise ValueError("Missing the required parameter `workspace` when calling `get_webhooks`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + query_params['workspace'] = workspace + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/webhooks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/webhooks', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/webhooks', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_webhook(self, body, webhook_gid, opts, **kwargs): # noqa: E501 + """Update a webhook # noqa: E501 + + An existing webhook's filters can be updated by making a PUT request on the URL for that webhook. Note that the webhook's previous `filters` array will be completely overwritten by the `filters` sent in the PUT request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_webhook(body, webhook_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated filters for the webhook. (required) + :param str webhook_gid: Globally unique identifier for the webhook. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_webhook_with_http_info(body, webhook_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_webhook_with_http_info(body, webhook_gid, opts, **kwargs) # noqa: E501 + return data + + def update_webhook_with_http_info(self, body, webhook_gid, opts, **kwargs): # noqa: E501 + """Update a webhook # noqa: E501 + + An existing webhook's filters can be updated by making a PUT request on the URL for that webhook. Note that the webhook's previous `filters` array will be completely overwritten by the `filters` sent in the PUT request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_webhook_with_http_info(body, webhook_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The updated filters for the webhook. (required) + :param str webhook_gid: Globally unique identifier for the webhook. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WebhookResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_webhook" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_webhook`") # noqa: E501 + # verify the required parameter 'webhook_gid' is set + if (webhook_gid is None): + raise ValueError("Missing the required parameter `webhook_gid` when calling `update_webhook`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['webhook_gid'] = webhook_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/webhooks/{webhook_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/webhooks/{webhook_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/webhooks/{webhook_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/workspace_memberships_api.py b/asana/api/workspace_memberships_api.py new file mode 100644 index 00000000..1fe3c726 --- /dev/null +++ b/asana/api/workspace_memberships_api.py @@ -0,0 +1,466 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class WorkspaceMembershipsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_workspace_membership(self, workspace_membership_gid, opts, **kwargs): # noqa: E501 + """Get a workspace membership # noqa: E501 + + Returns the complete workspace record for a single workspace membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_membership(workspace_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_workspace_membership_with_http_info(workspace_membership_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_workspace_membership_with_http_info(workspace_membership_gid, opts, **kwargs) # noqa: E501 + return data + + def get_workspace_membership_with_http_info(self, workspace_membership_gid, opts, **kwargs): # noqa: E501 + """Get a workspace membership # noqa: E501 + + Returns the complete workspace record for a single workspace membership. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_membership_with_http_info(workspace_membership_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_membership_gid: (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceMembershipResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_workspace_membership" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_membership_gid' is set + if (workspace_membership_gid is None): + raise ValueError("Missing the required parameter `workspace_membership_gid` when calling `get_workspace_membership`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_membership_gid'] = workspace_membership_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspace_memberships/{workspace_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspace_memberships/{workspace_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspace_memberships/{workspace_membership_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_workspace_memberships_for_user(self, user_gid, opts, **kwargs): # noqa: E501 + """Get workspace memberships for a user # noqa: E501 + + Returns the compact workspace membership records for the user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_memberships_for_user(user_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_workspace_memberships_for_user_with_http_info(user_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_workspace_memberships_for_user_with_http_info(user_gid, opts, **kwargs) # noqa: E501 + return data + + def get_workspace_memberships_for_user_with_http_info(self, user_gid, opts, **kwargs): # noqa: E501 + """Get workspace memberships for a user # noqa: E501 + + Returns the compact workspace membership records for the user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_memberships_for_user_with_http_info(user_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required) + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_workspace_memberships_for_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_gid' is set + if (user_gid is None): + raise ValueError("Missing the required parameter `user_gid` when calling `get_workspace_memberships_for_user`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['user_gid'] = user_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/users/{user_gid}/workspace_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/users/{user_gid}/workspace_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/users/{user_gid}/workspace_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_workspace_memberships_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get the workspace memberships for a workspace # noqa: E501 + + Returns the compact workspace membership records for the workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_memberships_for_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_workspace_memberships_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_workspace_memberships_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_workspace_memberships_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get the workspace memberships for a workspace # noqa: E501 + + Returns the compact workspace membership records for the workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_memberships_for_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceMembershipResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_workspace_memberships_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_workspace_memberships_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/workspace_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces/{workspace_gid}/workspace_memberships', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/workspace_memberships', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api/workspaces_api.py b/asana/api/workspaces_api.py new file mode 100644 index 00000000..f052defc --- /dev/null +++ b/asana/api/workspaces_api.py @@ -0,0 +1,753 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + 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 asana.api_client import ApiClient +from asana.pagination.event_iterator import EventIterator +from asana.pagination.page_iterator import PageIterator + +class WorkspacesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_user_for_workspace(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Add a user to a workspace or organization # noqa: E501 + + Add a user to a workspace or organization. The user can be referenced by their globally unique user ID or their email address. Returns the full user record for the invited user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_user_for_workspace(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to add to the workspace. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserBaseResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.add_user_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.add_user_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def add_user_for_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Add a user to a workspace or organization # noqa: E501 + + Add a user to a workspace or organization. The user can be referenced by their globally unique user ID or their email address. Returns the full user record for the invited user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_user_for_workspace_with_http_info(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to add to the workspace. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: UserBaseResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_user_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `add_user_for_workspace`") # noqa: E501 + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `add_user_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/addUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspaces/{workspace_gid}/addUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/addUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get a workspace # noqa: E501 + + Returns the full workspace record for a single workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.get_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def get_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501 + """Get a workspace # noqa: E501 + + Returns the full workspace record for a single workspace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspace_with_http_info(workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `get_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspaces/{workspace_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_workspaces(self, opts, **kwargs): # noqa: E501 + """Get multiple workspaces # noqa: E501 + + Returns the compact records for all workspaces visible to the authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspaces(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceResponseArray + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.get_workspaces_with_http_info(opts, **kwargs) # noqa: E501 + else: + (data) = self.get_workspaces_with_http_info(opts, **kwargs) # noqa: E501 + return data + + def get_workspaces_with_http_info(self, opts, **kwargs): # noqa: E501 + """Get multiple workspaces # noqa: E501 + + Returns the compact records for all workspaces visible to the authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_workspaces_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. + :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceResponseArray + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_workspaces" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) + return PageIterator( + self.api_client, + { + "resource_path": '/workspaces', + "method": 'GET', + "path_params": path_params, + "query_params": query_params, + "header_params": header_params, + "body": body_params, + "post_params": form_params, + "files": local_var_files, + "response_type": object, + "auth_settings": auth_settings, + "async_req": params.get('async_req'), + "_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 + }, + **kwargs + ).items() + else: + return self.api_client.call_api( + '/workspaces', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_user_for_workspace(self, body, workspace_gid, **kwargs): # noqa: E501 + """Remove a user from a workspace or organization # noqa: E501 + + Remove a user from a workspace or organization. The user making this call must be an admin in the workspace. The user can be referenced by their globally unique user ID or their email address. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_user_for_workspace(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to remove from the workspace. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.remove_user_for_workspace_with_http_info(body, workspace_gid, **kwargs) # noqa: E501 + else: + (data) = self.remove_user_for_workspace_with_http_info(body, workspace_gid, **kwargs) # noqa: E501 + return data + + def remove_user_for_workspace_with_http_info(self, body, workspace_gid, **kwargs): # noqa: E501 + """Remove a user from a workspace or organization # noqa: E501 + + Remove a user from a workspace or organization. The user making this call must be an admin in the workspace. The user can be referenced by their globally unique user ID or their email address. Returns an empty data record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_user_for_workspace_with_http_info(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The user to remove from the workspace. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :return: EmptyResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_user_for_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `remove_user_for_workspace`") # noqa: E501 + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `remove_user_for_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/removeUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspaces/{workspace_gid}/removeUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}/removeUser', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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_workspace(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Update a workspace # noqa: E501 + + A specific, existing workspace can be updated by making a PUT request on the URL for that workspace. Only the fields provided in the data block will be updated; any unspecified fields will remain unchanged. Currently the only field that can be modified for a workspace is its name. Returns the complete, updated workspace record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_workspace(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The workspace object with all updated properties. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceResponseData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) + if kwargs.get('async_req'): + return self.update_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + else: + (data) = self.update_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501 + return data + + def update_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs): # noqa: E501 + """Update a workspace # noqa: E501 + + A specific, existing workspace can be updated by making a PUT request on the URL for that workspace. Only the fields provided in the data block will be updated; any unspecified fields will remain unchanged. Currently the only field that can be modified for a workspace is its name. Returns the complete, updated workspace record. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_workspace_with_http_info(body, workspace_gid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict body: The workspace object with all updated properties. (required) + :param str workspace_gid: Globally unique identifier for the workspace or organization. (required) + :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + :return: WorkspaceResponseData + If the method is called asynchronously, + returns the request thread. + """ + all_params = [] + all_params.append('async_req') + all_params.append('header_params') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + all_params.append('full_payload') + all_params.append('item_limit') + + 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_workspace" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if (body is None): + raise ValueError("Missing the required parameter `body` when calling `update_workspace`") # noqa: E501 + # verify the required parameter 'workspace_gid' is set + if (workspace_gid is None): + raise ValueError("Missing the required parameter `workspace_gid` when calling `update_workspace`") # noqa: E501 + + collection_formats = {} + + path_params = {} + path_params['workspace_gid'] = workspace_gid # noqa: E501 + + query_params = [] + query_params = opts + + + header_params = kwargs.get("header_params", {}) + + form_params = [] + local_var_files = {} + + body_params = body + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json; charset=UTF-8']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json; charset=UTF-8']) # noqa: E501 + + # Authentication setting + auth_settings = ['personalAccessToken'] # noqa: E501 + + # hard checking for True boolean value because user can provide full_payload or async_req with any data type + if kwargs.get("full_payload", False) == True or kwargs.get('async_req', False) == True: + return self.api_client.call_api( + '/workspaces/{workspace_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 + ) + elif self.api_client.configuration.return_page_iterator: + (data) = self.api_client.call_api( + '/workspaces/{workspace_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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 params.get('_return_http_data_only') == False: + return data + return data["data"] if data else data + else: + return self.api_client.call_api( + '/workspaces/{workspace_gid}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=object, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _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) diff --git a/asana/api_client.py b/asana/api_client.py new file mode 100644 index 00000000..cb937f97 --- /dev/null +++ b/asana/api_client.py @@ -0,0 +1,626 @@ +# coding: utf-8 +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" +from __future__ import absolute_import + +import logging +import datetime +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import platform +import re +import tempfile + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import quote + +from asana.configuration import Configuration +from asana import rest + +from urllib.parse import urlencode + + +class ApiClient(object): + """Generic API client for Swagger client library builds. + + Swagger 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 + 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 + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + + try: + self.pool = ThreadPool() + except OSError: + logging.warning('Looks like your system does not support ThreadPool but it will try without it if you do not use async requests') + 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/5.0.0/python' + # Add custom header + self.default_headers['X-Asana-Client-Lib'] = urlencode( + { + 'language': 'Python', + 'version': '5.0.0', + 'language_version': platform.python_version(), + 'os': platform.system(), + 'os_version': platform.release() + } + ) + + def __del__(self): + if hasattr(self, "pool"): + self.pool.close() + self.pool.join() + + @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 + + 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): + + 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) + ) + + # 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 = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # 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) + else: + return (return_data, response_data.status, + response_data.getheaders()) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + 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 list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is swagger 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, self.PRIMITIVE_TYPES): + return 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() + + if isinstance(obj, dict): + obj_dict = obj + 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): + """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. + + :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: + # Decode the byte string and replace non-breaking space characters with regular + # spaces then parse the json bytes into a python dict + data = json.loads(response.data.decode('utf8').replace('\xa0', ' ')) + except ValueError: + data = response.data + + 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 type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match(r'list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datatime(data) + else: + return data + + 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_req=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_req 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_req 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_req parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async_req is False or missing, + then the method will return the response directly. + """ + + # Convert query params dict into a list of query param tuples. + # This step was previous implemented in the api.mustache but we needed + # to modify the query params dict for pagination so we move this conversion step here + query_params = [(k, v) for k, v in query_params.items()] + + if not async_req: + 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. + + :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 = [] + if collection_formats is None: + collection_formats = {} + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + 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 prepare_post_parameters(self, post_params=None, files=None): + """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])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + 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 '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] + + def update_params_for_auth(self, headers, querys, auth_settings): + """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 auth_settings: Authentication setting identifiers list. + """ + if not auth_settings: + return + + for auth in auth_settings: + # In the OAS we define "personalAccessToken" but for the SDK we want users to use the term "token" + # this logic will get the auth_settings for "token" settings that we've added + if auth == 'personalAccessToken': + auth_setting = self.configuration.auth_settings().get('token') + else: + 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`' + ) + + 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. + + :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.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + response_data = response.data + with open(path, "wb") as f: + if isinstance(response_data, str): + # change str to bytes so we can write it + response_data = response_data.encode('utf-8') + f.write(response_data) + else: + 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 six.text_type(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return a original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + 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_datatime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + 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 __hasattr(self, object, name): + return name in object.__class__.__dict__ diff --git a/asana/configuration.py b/asana/configuration.py new file mode 100644 index 00000000..57cd5da3 --- /dev/null +++ b/asana/configuration.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import copy +import logging +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) + + +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. + """ + + def __init__(self): + """Constructor""" + # Default Base url + self.host = "https://app.asana.com/api/1.0" + # Temp file folder for downloading files + self.temp_folder_path = None + + # Authentication Settings + # dict to store API key(s) + self.api_key = {} + # dict to store API prefix (e.g. Bearer) + self.api_key_prefix = {} + # function to refresh API key if expired + self.refresh_api_key_hook = None + # Username for HTTP basic authentication + self.username = "" + # Password for HTTP basic authentication + self.password = "" + # Logging Settings + self.logger = {} + self.logger["package_logger"] = logging.getLogger("asana") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + # Log format + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + # Log stream handler + self.logger_stream_handler = None + # Log file handler + self.logger_file_handler = None + # Debug file location + 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 = '' + + # Collection + # by default we return a collection object to be used for pagination. + # If the user wants to turn this off they can set this to False + self.return_page_iterator = True + + # The default limit query parameter value for api endpoints that return multiple resources + self.page_limit = 100 + + @property + def logger_file(self): + """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): + """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 six.iteritems(self.logger): + 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): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """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 six.iteritems(self.logger): + 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): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """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): + """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): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook: + self.refresh_api_key_hook(self) + + key = self.api_key.get(identifier) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + return urllib3.util.make_headers( + basic_auth=self.username + ':' + self.password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + return { + # Add a case for OAS bearer token definition + 'token': + { + 'type': 'token', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + }, + } + + def to_debug_report(self): + """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: 1.0\n"\ + "SDK Package Version: 5.0.0".\ + format(env=sys.platform, pyversion=sys.version) diff --git a/asana/pagination/__init__.py b/asana/pagination/__init__.py new file mode 100644 index 00000000..c9c10e9f --- /dev/null +++ b/asana/pagination/__init__.py @@ -0,0 +1,19 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +# import pagination into pagination package +from asana.pagination.page_iterator import PageIterator +from asana.pagination.event_iterator import EventIterator diff --git a/asana/pagination/event_iterator.py b/asana/pagination/event_iterator.py new file mode 100644 index 00000000..6ccc5250 --- /dev/null +++ b/asana/pagination/event_iterator.py @@ -0,0 +1,38 @@ +import json +from asana.pagination.page_iterator import PageIterator +from asana.rest import ApiException + +class EventIterator(PageIterator): + def __init__(self, api_client, api_request_data, **kwargs): + super().__init__(api_client, api_request_data, **kwargs) + self.sync = False + self.has_more = True + + def __next__(self): + if not self.has_more: + raise StopIteration + + result = {} + + try: + result = self.call_api() + except ApiException as e: + if (e.status == 412): + errors = json.loads(e.body.decode("utf-8")) + self.sync = errors["sync"] + else: + raise e + + if (self.sync): + self.api_request_data["query_params"]["sync"] = self.sync + else: + self.sync = result.get('sync', None) + + if not result: + try: + result = self.call_api() + except ApiException as e: + raise e + + self.has_more = result.get('has_more', False) + return result["data"] diff --git a/asana/pagination/page_iterator.py b/asana/pagination/page_iterator.py new file mode 100644 index 00000000..66c078e1 --- /dev/null +++ b/asana/pagination/page_iterator.py @@ -0,0 +1,64 @@ +from asana.rest import ApiException + +class PageIterator(object): + def __init__(self, api_client, api_request_data, **kwargs): + self.__api_client = api_client + self.api_request_data = api_request_data + self.next_page = False + self.item_limit = float('inf') if kwargs.get('item_limit', None) == None else kwargs.get('item_limit') + self.count = 0 + + def __iter__(self): + """Iterator interface, self is an iterator""" + return self + + def __next__(self): + limit = self.api_request_data["query_params"].get("limit", None) + if limit: + self.api_request_data["query_params"]["limit"] = min(limit, self.item_limit - self.count) + + if self.next_page is None or self.api_request_data["query_params"].get("limit", None) == 0: + raise StopIteration + + try: + result = self.call_api() + except ApiException as e: + raise e + + # If the response has a next_page add the offset to the api_request_data for the next request + self.next_page = result.get('next_page', None) + if (self.next_page): + self.api_request_data["query_params"]["offset"] = self.next_page["offset"] + data = result['data'] + if data != None: + self.count += len(data) + return data + + def next(self): + """Alias for __next__""" + return self.__next__() + + def items(self): + """Returns an iterator for each item in each page""" + for page in self: + for item in page: + yield item + + def call_api(self): + return self.__api_client.call_api( + self.api_request_data["resource_path"], + self.api_request_data["method"], + self.api_request_data["path_params"], + self.api_request_data["query_params"], + self.api_request_data["header_params"], + self.api_request_data["body"], + self.api_request_data["post_params"], + self.api_request_data["files"], + self.api_request_data["response_type"], + self.api_request_data["auth_settings"], + self.api_request_data["async_req"], + self.api_request_data["_return_http_data_only"], + self.api_request_data["collection_formats"], + self.api_request_data["_preload_content"], + self.api_request_data["_request_timeout"] + ) diff --git a/asana/rest.py b/asana/rest.py new file mode 100644 index 00000000..8b169f7f --- /dev/null +++ b/asana/rest.py @@ -0,0 +1,317 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import io +import json +import logging +import re +import ssl + +import certifi +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import urlencode + +try: + import urllib3 +except ImportError: + raise ImportError('Swagger python client requires urllib3.') + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp): + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.getheaders() + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.getheader(name, default) + + +class RESTClientObject(object): + + def __init__(self, configuration, pools_size=4, maxsize=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 + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + 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 = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # 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 + ) + 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): + """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'] + + if post_params and body: + raise ValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 + timeout = urllib3.Timeout(total=_request_timeout) + 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' + + 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): + request_body = '{}' + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=False, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['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'] + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=True, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + # 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 + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + 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) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request(method, url, + fields=query_params, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + except urllib3.exceptions.SSLError as e: + msg = "{0}\n{1}".format(type(e).__name__, str(e)) + raise ApiException(status=0, reason=msg) + + if _preload_content: + r = RESTResponse(r) + + # 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 diff --git a/docs/AttachmentsApi.md b/docs/AttachmentsApi.md new file mode 100644 index 00000000..4d2eda6e --- /dev/null +++ b/docs/AttachmentsApi.md @@ -0,0 +1,227 @@ +# asana.AttachmentsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_attachment_for_object**](AttachmentsApi.md#create_attachment_for_object) | **POST** /attachments | Upload an attachment +[**delete_attachment**](AttachmentsApi.md#delete_attachment) | **DELETE** /attachments/{attachment_gid} | Delete an attachment +[**get_attachment**](AttachmentsApi.md#get_attachment) | **GET** /attachments/{attachment_gid} | Get an attachment +[**get_attachments_for_object**](AttachmentsApi.md#get_attachments_for_object) | **GET** /attachments | Get attachments from an object + +# **create_attachment_for_object** + +Upload an attachment + +Upload an attachment. This method uploads an attachment on an object and returns the compact record for the created attachment object. This is possible by either: - Providing the URL of the external resource being attached, or - Downloading the file content first and then uploading it as any other attachment. Note that it is not possible to attach files from third party services such as Dropbox, Box, Vimeo & Google Drive via the API The 100MB size limit on attachments in Asana is enforced on this endpoint. This endpoint expects a multipart/form-data encoded request containing the full contents of the file to be uploaded. Requests made should follow the HTTP/1.1 specification that line terminators are of the form `CRLF` or `\\r\\n` outlined [here](http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01#Basic-Rules) in order for the server to reliably and properly handle the request. + +([more information](https://developers.asana.com/reference/createattachmentforobject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +attachments_api_instance = asana.AttachmentsApi(api_client) +opts = { + 'resource_subtype': "external" # str | + 'file': "file_example" # str | + 'parent': "parent_example" # str | + 'url': "url_example" # str | + 'name': "name_example" # str | + 'connect_to_app': True # bool | + 'opt_fields': "connected_to_app,created_at,download_url,host,name,parent,parent.created_by,parent.name,parent.resource_subtype,permanent_url,resource_subtype,size,view_url" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Upload an attachment + api_response = attachments_api_instance.create_attachment_for_object(opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling AttachmentsApi->create_attachment_for_object: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource_subtype** | **str**| | [optional] + **file** | **str**| | [optional] + **parent** | **str**| | [optional] + **url** | **str**| | [optional] + **name** | **str**| | [optional] + **connect_to_app** | **bool**| | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_attachment** + +Delete an attachment + +Deletes a specific, existing attachment. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deleteattachment)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +attachments_api_instance = asana.AttachmentsApi(api_client) +attachment_gid = "12345" # str | Globally unique identifier for the attachment. + + +try: + # Delete an attachment + api_response = attachments_api_instance.delete_attachment(attachment_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling AttachmentsApi->delete_attachment: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **attachment_gid** | **str**| Globally unique identifier for the attachment. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_attachment** + +Get an attachment + +Get the full record for a single attachment. + +([more information](https://developers.asana.com/reference/getattachment)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +attachments_api_instance = asana.AttachmentsApi(api_client) +attachment_gid = "12345" # str | Globally unique identifier for the attachment. +opts = { + 'opt_fields': "connected_to_app,created_at,download_url,host,name,parent,parent.created_by,parent.name,parent.resource_subtype,permanent_url,resource_subtype,size,view_url" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get an attachment + api_response = attachments_api_instance.get_attachment(attachment_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling AttachmentsApi->get_attachment: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **attachment_gid** | **str**| Globally unique identifier for the attachment. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_attachments_for_object** + +Get attachments from an object + +Returns the compact records for all attachments on the object. There are three possible `parent` values for this request: `project`, `project_brief`, and `task`. For a project, an attachment refers to a file uploaded to the \"Key resources\" section in the project Overview. For a project brief, an attachment refers to inline files in the project brief itself. For a task, an attachment refers to a file directly associated to that task. Note that within the Asana app, inline images in the task description do not appear in the index of image thumbnails nor as stories in the task. However, requests made to `GET /attachments` for a task will return all of the images in the task, including inline images. + +([more information](https://developers.asana.com/reference/getattachmentsforobject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +attachments_api_instance = asana.AttachmentsApi(api_client) +parent = "159874" # str | Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "connected_to_app,created_at,download_url,host,name,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permanent_url,resource_subtype,size,uri,view_url" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get attachments from an object + api_response = attachments_api_instance.get_attachments_for_object(parent, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling AttachmentsApi->get_attachments_for_object: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **parent** | **str**| Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/AttachmentsApi.yaml b/docs/AttachmentsApi.yaml new file mode 100644 index 00000000..4bac2b73 --- /dev/null +++ b/docs/AttachmentsApi.yaml @@ -0,0 +1,95 @@ +AttachmentsApi: + create_attachment_for_object: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + attachments_api_instance = asana.AttachmentsApi(api_client) + opts = { + 'resource_subtype': "external" # str | + 'file': "file_example" # str | + 'parent': "parent_example" # str | + 'url': "url_example" # str | + 'name': "name_example" # str | + 'connect_to_app': True # bool | + 'opt_fields': "connected_to_app,created_at,download_url,host,name,parent,parent.created_by,parent.name,parent.resource_subtype,permanent_url,resource_subtype,size,view_url" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Upload an attachment + api_response = attachments_api_instance.create_attachment_for_object(opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling AttachmentsApi->create_attachment_for_object: %s\n" % e) + delete_attachment: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + attachments_api_instance = asana.AttachmentsApi(api_client) + attachment_gid = "12345" # str | Globally unique identifier for the attachment. + + + try: + # Delete an attachment + api_response = attachments_api_instance.delete_attachment(attachment_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling AttachmentsApi->delete_attachment: %s\n" % e) + get_attachment: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + attachments_api_instance = asana.AttachmentsApi(api_client) + attachment_gid = "12345" # str | Globally unique identifier for the attachment. + opts = { + 'opt_fields': "connected_to_app,created_at,download_url,host,name,parent,parent.created_by,parent.name,parent.resource_subtype,permanent_url,resource_subtype,size,view_url" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get an attachment + api_response = attachments_api_instance.get_attachment(attachment_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling AttachmentsApi->get_attachment: %s\n" % e) + get_attachments_for_object: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + attachments_api_instance = asana.AttachmentsApi(api_client) + parent = "159874" # str | Globally unique identifier for object to fetch statuses from. Must be a GID for a `project`, `project_brief`, or `task`. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "connected_to_app,created_at,download_url,host,name,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permanent_url,resource_subtype,size,uri,view_url" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get attachments from an object + api_response = attachments_api_instance.get_attachments_for_object(parent, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling AttachmentsApi->get_attachments_for_object: %s\n" % e) diff --git a/docs/AuditLogAPIApi.md b/docs/AuditLogAPIApi.md new file mode 100644 index 00000000..0f8b41c5 --- /dev/null +++ b/docs/AuditLogAPIApi.md @@ -0,0 +1,74 @@ +# asana.AuditLogAPIApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_audit_log_events**](AuditLogAPIApi.md#get_audit_log_events) | **GET** /workspaces/{workspace_gid}/audit_log_events | Get audit log events + +# **get_audit_log_events** + +Get audit log events + +Retrieve the audit log events that have been captured in your domain. This endpoint will return a list of [AuditLogEvent](/reference/audit-log-api) objects, sorted by creation time in ascending order. Note that the Audit Log API captures events from October 8th, 2021 and later. Queries for events before this date will not return results. There are a number of query parameters (below) that can be used to filter the set of [AuditLogEvent](/reference/audit-log-api) objects that are returned in the response. Any combination of query parameters is valid. When no filters are provided, all of the events that have been captured in your domain will match. The list of events will always be [paginated](/docs/pagination). The default limit is 1000 events. The next set of events can be retrieved using the `offset` from the previous response. If there are no events that match the provided filters in your domain, the endpoint will return `null` for the `next_page` field. Querying again with the same filters may return new events if they were captured after the last request. Once a response includes a `next_page` with an `offset`, subsequent requests can be made with the latest `offset` to poll for new events that match the provided filters. *Note: If the filters you provided match events in your domain and `next_page` is present in the response, we will continue to send `next_page` on subsequent requests even when there are no more events that match the filters. This was put in place so that you can implement an audit log stream that will return future events that match these filters. If you are not interested in future events that match the filters you have defined, you can rely on checking empty `data` response for the end of current events that match your filters.* When no `offset` is provided, the response will begin with the oldest events that match the provided filters. It is important to note that [AuditLogEvent](/reference/audit-log-api) objects will be permanently deleted from our systems after 90 days. If you wish to keep a permanent record of these events, we recommend using a SIEM tool to ingest and store these logs. + +([more information](https://developers.asana.com/reference/getauditlogevents)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +audit_log_api_api_instance = asana.AuditLogAPIApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'start_at': '2013-10-20T19:20:30+01:00', # datetime | Filter to events created after this time (inclusive). + 'end_at': '2013-10-20T19:20:30+01:00', # datetime | Filter to events created before this time (exclusive). + 'event_type': "event_type_example", # str | Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values. + 'actor_type': "actor_type_example", # str | Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded. + 'actor_gid': "actor_gid_example", # str | Filter to events triggered by the actor with this ID. + 'resource_gid': "resource_gid_example", # str | Filter to events with this resource ID. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9" # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' +} + +try: + # Get audit log events + api_response = audit_log_api_api_instance.get_audit_log_events(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling AuditLogAPIApi->get_audit_log_events: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **start_at** | **datetime**| Filter to events created after this time (inclusive). | [optional] + **end_at** | **datetime**| Filter to events created before this time (exclusive). | [optional] + **event_type** | **str**| Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values. | [optional] + **actor_type** | **str**| Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded. | [optional] + **actor_gid** | **str**| Filter to events triggered by the actor with this ID. | [optional] + **resource_gid** | **str**| Filter to events with this resource ID. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/AuditLogAPIApi.yaml b/docs/AuditLogAPIApi.yaml new file mode 100644 index 00000000..495783a4 --- /dev/null +++ b/docs/AuditLogAPIApi.yaml @@ -0,0 +1,31 @@ +AuditLogAPIApi: + get_audit_log_events: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + audit_log_api_api_instance = asana.AuditLogAPIApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'start_at': '2013-10-20T19:20:30+01:00', # datetime | Filter to events created after this time (inclusive). + 'end_at': '2013-10-20T19:20:30+01:00', # datetime | Filter to events created before this time (exclusive). + 'event_type': "event_type_example", # str | Filter to events of this type. Refer to the [supported audit log events](/docs/audit-log-events#supported-audit-log-events) for a full list of values. + 'actor_type': "actor_type_example", # str | Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded. + 'actor_gid': "actor_gid_example", # str | Filter to events triggered by the actor with this ID. + 'resource_gid': "resource_gid_example", # str | Filter to events with this resource ID. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9" # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + } + + try: + # Get audit log events + api_response = audit_log_api_api_instance.get_audit_log_events(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling AuditLogAPIApi->get_audit_log_events: %s\n" % e) diff --git a/docs/BatchAPIApi.md b/docs/BatchAPIApi.md new file mode 100644 index 00000000..7b6c57e6 --- /dev/null +++ b/docs/BatchAPIApi.md @@ -0,0 +1,60 @@ +# asana.BatchAPIApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_batch_request**](BatchAPIApi.md#create_batch_request) | **POST** /batch | Submit parallel requests + +# **create_batch_request** + +Submit parallel requests + +Make multiple requests in parallel to Asana's API. + +([more information](https://developers.asana.com/reference/createbatchrequest)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +batch_api_api_instance = asana.BatchAPIApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The requests to batch together via the Batch API. +opts = { + 'opt_fields': "body,headers,status_code" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Submit parallel requests + api_response = batch_api_api_instance.create_batch_request(body, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling BatchAPIApi->create_batch_request: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The requests to batch together via the Batch API. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/BatchAPIApi.yaml b/docs/BatchAPIApi.yaml new file mode 100644 index 00000000..bf6ecb83 --- /dev/null +++ b/docs/BatchAPIApi.yaml @@ -0,0 +1,24 @@ +BatchAPIApi: + create_batch_request: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + batch_api_api_instance = asana.BatchAPIApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The requests to batch together via the Batch API. + opts = { + 'opt_fields': "body,headers,status_code" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Submit parallel requests + api_response = batch_api_api_instance.create_batch_request(body, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling BatchAPIApi->create_batch_request: %s\n" % e) diff --git a/docs/CustomFieldSettingsApi.md b/docs/CustomFieldSettingsApi.md new file mode 100644 index 00000000..acd98728 --- /dev/null +++ b/docs/CustomFieldSettingsApi.md @@ -0,0 +1,121 @@ +# asana.CustomFieldSettingsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_custom_field_settings_for_portfolio**](CustomFieldSettingsApi.md#get_custom_field_settings_for_portfolio) | **GET** /portfolios/{portfolio_gid}/custom_field_settings | Get a portfolio's custom fields +[**get_custom_field_settings_for_project**](CustomFieldSettingsApi.md#get_custom_field_settings_for_project) | **GET** /projects/{project_gid}/custom_field_settings | Get a project's custom fields + +# **get_custom_field_settings_for_portfolio** + +Get a portfolio's custom fields + +Returns a list of all of the custom fields settings on a portfolio, in compact form. + +([more information](https://developers.asana.com/reference/getcustomfieldsettingsforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_field_settings_api_instance = asana.CustomFieldSettingsApi(api_client) +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "custom_field,custom_field.asana_created_field,custom_field.created_by,custom_field.created_by.name,custom_field.currency_code,custom_field.custom_label,custom_field.custom_label_position,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.description,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.format,custom_field.has_notifications_enabled,custom_field.is_formula_field,custom_field.is_global_to_workspace,custom_field.is_value_read_only,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.people_value,custom_field.people_value.name,custom_field.precision,custom_field.resource_subtype,custom_field.text_value,custom_field.type,is_important,offset,parent,parent.name,path,project,project.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a portfolio's custom fields + api_response = custom_field_settings_api_instance.get_custom_field_settings_for_portfolio(portfolio_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling CustomFieldSettingsApi->get_custom_field_settings_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_custom_field_settings_for_project** + +Get a project's custom fields + +Returns a list of all of the custom fields settings on a project, in compact form. Note that, as in all queries to collections which return compact representation, `opt_fields` can be used to include more data than is returned in the compact representation. See the [documentation for input/output options](https://developers.asana.com/docs/inputoutput-options) for more information. + +([more information](https://developers.asana.com/reference/getcustomfieldsettingsforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_field_settings_api_instance = asana.CustomFieldSettingsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "custom_field,custom_field.asana_created_field,custom_field.created_by,custom_field.created_by.name,custom_field.currency_code,custom_field.custom_label,custom_field.custom_label_position,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.description,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.format,custom_field.has_notifications_enabled,custom_field.is_formula_field,custom_field.is_global_to_workspace,custom_field.is_value_read_only,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.people_value,custom_field.people_value.name,custom_field.precision,custom_field.resource_subtype,custom_field.text_value,custom_field.type,is_important,offset,parent,parent.name,path,project,project.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a project's custom fields + api_response = custom_field_settings_api_instance.get_custom_field_settings_for_project(project_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling CustomFieldSettingsApi->get_custom_field_settings_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/CustomFieldSettingsApi.yaml b/docs/CustomFieldSettingsApi.yaml new file mode 100644 index 00000000..4e83314b --- /dev/null +++ b/docs/CustomFieldSettingsApi.yaml @@ -0,0 +1,51 @@ +CustomFieldSettingsApi: + get_custom_field_settings_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_field_settings_api_instance = asana.CustomFieldSettingsApi(api_client) + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "custom_field,custom_field.asana_created_field,custom_field.created_by,custom_field.created_by.name,custom_field.currency_code,custom_field.custom_label,custom_field.custom_label_position,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.description,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.format,custom_field.has_notifications_enabled,custom_field.is_formula_field,custom_field.is_global_to_workspace,custom_field.is_value_read_only,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.people_value,custom_field.people_value.name,custom_field.precision,custom_field.resource_subtype,custom_field.text_value,custom_field.type,is_important,offset,parent,parent.name,path,project,project.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a portfolio's custom fields + api_response = custom_field_settings_api_instance.get_custom_field_settings_for_portfolio(portfolio_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling CustomFieldSettingsApi->get_custom_field_settings_for_portfolio: %s\n" % e) + get_custom_field_settings_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_field_settings_api_instance = asana.CustomFieldSettingsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "custom_field,custom_field.asana_created_field,custom_field.created_by,custom_field.created_by.name,custom_field.currency_code,custom_field.custom_label,custom_field.custom_label_position,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.description,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.format,custom_field.has_notifications_enabled,custom_field.is_formula_field,custom_field.is_global_to_workspace,custom_field.is_value_read_only,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.people_value,custom_field.people_value.name,custom_field.precision,custom_field.resource_subtype,custom_field.text_value,custom_field.type,is_important,offset,parent,parent.name,path,project,project.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a project's custom fields + api_response = custom_field_settings_api_instance.get_custom_field_settings_for_project(project_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling CustomFieldSettingsApi->get_custom_field_settings_for_project: %s\n" % e) diff --git a/docs/CustomFieldsApi.md b/docs/CustomFieldsApi.md new file mode 100644 index 00000000..4af01f02 --- /dev/null +++ b/docs/CustomFieldsApi.md @@ -0,0 +1,433 @@ +# asana.CustomFieldsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_custom_field**](CustomFieldsApi.md#create_custom_field) | **POST** /custom_fields | Create a custom field +[**create_enum_option_for_custom_field**](CustomFieldsApi.md#create_enum_option_for_custom_field) | **POST** /custom_fields/{custom_field_gid}/enum_options | Create an enum option +[**delete_custom_field**](CustomFieldsApi.md#delete_custom_field) | **DELETE** /custom_fields/{custom_field_gid} | Delete a custom field +[**get_custom_field**](CustomFieldsApi.md#get_custom_field) | **GET** /custom_fields/{custom_field_gid} | Get a custom field +[**get_custom_fields_for_workspace**](CustomFieldsApi.md#get_custom_fields_for_workspace) | **GET** /workspaces/{workspace_gid}/custom_fields | Get a workspace's custom fields +[**insert_enum_option_for_custom_field**](CustomFieldsApi.md#insert_enum_option_for_custom_field) | **POST** /custom_fields/{custom_field_gid}/enum_options/insert | Reorder a custom field's enum +[**update_custom_field**](CustomFieldsApi.md#update_custom_field) | **PUT** /custom_fields/{custom_field_gid} | Update a custom field +[**update_enum_option**](CustomFieldsApi.md#update_enum_option) | **PUT** /enum_options/{enum_option_gid} | Update an enum option + +# **create_custom_field** + +Create a custom field + +Creates a new custom field in a workspace. Every custom field is required to be created in a specific workspace, and this workspace cannot be changed once set. A custom field’s name must be unique within a workspace and not conflict with names of existing task properties such as `Due Date` or `Assignee`. A custom field’s type must be one of `text`, `enum`, `multi_enum`, `number`, `date`, or `people`. Returns the full record of the newly created custom field. + +([more information](https://developers.asana.com/reference/createcustomfield)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The custom field object to create. +opts = { + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,resource_subtype,text_value,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a custom field + api_response = custom_fields_api_instance.create_custom_field(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->create_custom_field: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The custom field object to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_enum_option_for_custom_field** + +Create an enum option + +Creates an enum option and adds it to this custom field’s list of enum options. A custom field can have at most 500 enum options (including disabled options). By default new enum options are inserted at the end of a custom field’s list. Locked custom fields can only have enum options added by the user who locked the field. Returns the full record of the newly created enum option. + +([more information](https://developers.asana.com/reference/createenumoptionforcustomfield)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +custom_field_gid = "12345" # str | Globally unique identifier for the custom field. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The enum option object to create. + 'opt_fields': "color,enabled,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create an enum option + api_response = custom_fields_api_instance.create_enum_option_for_custom_field(custom_field_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->create_enum_option_for_custom_field: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **custom_field_gid** | **str**| Globally unique identifier for the custom field. | + **body** | **Dict**| The enum option object to create. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_custom_field** + +Delete a custom field + +A specific, existing custom field can be deleted by making a DELETE request on the URL for that custom field. Locked custom fields can only be deleted by the user who locked the field. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletecustomfield)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +custom_field_gid = "12345" # str | Globally unique identifier for the custom field. + + +try: + # Delete a custom field + api_response = custom_fields_api_instance.delete_custom_field(custom_field_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->delete_custom_field: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **custom_field_gid** | **str**| Globally unique identifier for the custom field. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_custom_field** + +Get a custom field + +Get the complete definition of a custom field’s metadata. Since custom fields can be defined for one of a number of types, and these types have different data and behaviors, there are fields that are relevant to a particular type. For instance, as noted above, enum_options is only relevant for the enum type and defines the set of choices that the enum could represent. The examples below show some of these type-specific custom field definitions. + +([more information](https://developers.asana.com/reference/getcustomfield)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +custom_field_gid = "12345" # str | Globally unique identifier for the custom field. +opts = { + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,resource_subtype,text_value,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a custom field + api_response = custom_fields_api_instance.get_custom_field(custom_field_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->get_custom_field: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **custom_field_gid** | **str**| Globally unique identifier for the custom field. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_custom_fields_for_workspace** + +Get a workspace's custom fields + +Returns a list of the compact representation of all of the custom fields in a workspace. + +([more information](https://developers.asana.com/reference/getcustomfieldsforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,offset,path,people_value,people_value.name,precision,resource_subtype,text_value,type,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a workspace's custom fields + api_response = custom_fields_api_instance.get_custom_fields_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling CustomFieldsApi->get_custom_fields_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **insert_enum_option_for_custom_field** + +Reorder a custom field's enum + +Moves a particular enum option to be either before or after another specified enum option in the custom field. Locked custom fields can only be reordered by the user who locked the field. + +([more information](https://developers.asana.com/reference/insertenumoptionforcustomfield)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +custom_field_gid = "12345" # str | Globally unique identifier for the custom field. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The enum option object to create. + 'opt_fields': "color,enabled,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Reorder a custom field's enum + api_response = custom_fields_api_instance.insert_enum_option_for_custom_field(custom_field_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->insert_enum_option_for_custom_field: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **custom_field_gid** | **str**| Globally unique identifier for the custom field. | + **body** | **Dict**| The enum option object to create. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_custom_field** + +Update a custom field + +A specific, existing custom field can be updated by making a PUT request on the URL for that custom field. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the custom field. A custom field’s `type` cannot be updated. An enum custom field’s `enum_options` cannot be updated with this endpoint. Instead see “Work With Enum Options” for information on how to update `enum_options`. Locked custom fields can only be updated by the user who locked the field. Returns the complete updated custom field record. + +([more information](https://developers.asana.com/reference/updatecustomfield)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +custom_field_gid = "12345" # str | Globally unique identifier for the custom field. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The custom field object with all updated properties. + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,resource_subtype,text_value,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a custom field + api_response = custom_fields_api_instance.update_custom_field(custom_field_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->update_custom_field: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **custom_field_gid** | **str**| Globally unique identifier for the custom field. | + **body** | **Dict**| The custom field object with all updated properties. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_enum_option** + +Update an enum option + +Updates an existing enum option. Enum custom fields require at least one enabled enum option. Locked custom fields can only be updated by the user who locked the field. Returns the full record of the updated enum option. + +([more information](https://developers.asana.com/reference/updateenumoption)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +custom_fields_api_instance = asana.CustomFieldsApi(api_client) +enum_option_gid = "124578" # str | Globally unique identifier for the enum option. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The enum option object to update + 'opt_fields': "color,enabled,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update an enum option + api_response = custom_fields_api_instance.update_enum_option(enum_option_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling CustomFieldsApi->update_enum_option: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enum_option_gid** | **str**| Globally unique identifier for the enum option. | + **body** | **Dict**| The enum option object to update | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/CustomFieldsApi.yaml b/docs/CustomFieldsApi.yaml new file mode 100644 index 00000000..1d3b56df --- /dev/null +++ b/docs/CustomFieldsApi.yaml @@ -0,0 +1,182 @@ +CustomFieldsApi: + create_custom_field: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The custom field object to create. + opts = { + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,resource_subtype,text_value,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a custom field + api_response = custom_fields_api_instance.create_custom_field(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->create_custom_field: %s\n" % e) + create_enum_option_for_custom_field: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + custom_field_gid = "12345" # str | Globally unique identifier for the custom field. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The enum option object to create. + 'opt_fields': "color,enabled,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create an enum option + api_response = custom_fields_api_instance.create_enum_option_for_custom_field(custom_field_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->create_enum_option_for_custom_field: %s\n" % e) + delete_custom_field: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + custom_field_gid = "12345" # str | Globally unique identifier for the custom field. + + + try: + # Delete a custom field + api_response = custom_fields_api_instance.delete_custom_field(custom_field_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->delete_custom_field: %s\n" % e) + get_custom_field: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + custom_field_gid = "12345" # str | Globally unique identifier for the custom field. + opts = { + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,resource_subtype,text_value,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a custom field + api_response = custom_fields_api_instance.get_custom_field(custom_field_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->get_custom_field: %s\n" % e) + get_custom_fields_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,offset,path,people_value,people_value.name,precision,resource_subtype,text_value,type,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a workspace's custom fields + api_response = custom_fields_api_instance.get_custom_fields_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling CustomFieldsApi->get_custom_fields_for_workspace: %s\n" % e) + insert_enum_option_for_custom_field: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + custom_field_gid = "12345" # str | Globally unique identifier for the custom field. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The enum option object to create. + 'opt_fields': "color,enabled,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Reorder a custom field's enum + api_response = custom_fields_api_instance.insert_enum_option_for_custom_field(custom_field_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->insert_enum_option_for_custom_field: %s\n" % e) + update_custom_field: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + custom_field_gid = "12345" # str | Globally unique identifier for the custom field. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The custom field object with all updated properties. + 'opt_fields': "asana_created_field,created_by,created_by.name,currency_code,custom_label,custom_label_position,date_value,date_value.date,date_value.date_time,description,display_value,enabled,enum_options,enum_options.color,enum_options.enabled,enum_options.name,enum_value,enum_value.color,enum_value.enabled,enum_value.name,format,has_notifications_enabled,is_formula_field,is_global_to_workspace,is_value_read_only,multi_enum_values,multi_enum_values.color,multi_enum_values.enabled,multi_enum_values.name,name,number_value,people_value,people_value.name,precision,resource_subtype,text_value,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a custom field + api_response = custom_fields_api_instance.update_custom_field(custom_field_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->update_custom_field: %s\n" % e) + update_enum_option: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + custom_fields_api_instance = asana.CustomFieldsApi(api_client) + enum_option_gid = "124578" # str | Globally unique identifier for the enum option. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The enum option object to update + 'opt_fields': "color,enabled,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update an enum option + api_response = custom_fields_api_instance.update_enum_option(enum_option_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling CustomFieldsApi->update_enum_option: %s\n" % e) diff --git a/docs/EventsApi.md b/docs/EventsApi.md new file mode 100644 index 00000000..32c112c4 --- /dev/null +++ b/docs/EventsApi.md @@ -0,0 +1,62 @@ +# asana.EventsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_events**](EventsApi.md#get_events) | **GET** /events | Get events on a resource + +# **get_events** + +Get events on a resource + +Returns the full record for all events that have occurred since the sync token was created. A `GET` request to the endpoint `/[path_to_resource]/events` can be made in lieu of including the resource ID in the data for the request. Asana limits a single sync token to 100 events. If more than 100 events exist for a given resource, `has_more: true` will be returned in the response, indicating that there are more events to pull. *Note: The resource returned will be the resource that triggered the event. This may be different from the one that the events were requested for. For example, a subscription to a project will contain events for tasks contained within the project.* + +([more information](https://developers.asana.com/reference/getevents)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +events_api_instance = asana.EventsApi(api_client) +resource = "12345" # str | A resource ID to subscribe to. The resource can be a task or project. +opts = { + 'sync': "de4774f6915eae04714ca93bb2f5ee81", # str | A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.* + 'opt_fields': "action,change,change.action,change.added_value,change.field,change.new_value,change.removed_value,created_at,parent,parent.name,resource,resource.name,type,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get events on a resource + api_response = events_api_instance.get_events(resource, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling EventsApi->get_events: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resource** | **str**| A resource ID to subscribe to. The resource can be a task or project. | + **sync** | **str**| A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.* | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/EventsApi.yaml b/docs/EventsApi.yaml new file mode 100644 index 00000000..35b93e8f --- /dev/null +++ b/docs/EventsApi.yaml @@ -0,0 +1,25 @@ +EventsApi: + get_events: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + events_api_instance = asana.EventsApi(api_client) + resource = "12345" # str | A resource ID to subscribe to. The resource can be a task or project. + opts = { + 'sync': "de4774f6915eae04714ca93bb2f5ee81", # str | A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.* + 'opt_fields': "action,change,change.action,change.added_value,change.field,change.new_value,change.removed_value,created_at,parent,parent.name,resource,resource.name,type,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get events on a resource + api_response = events_api_instance.get_events(resource, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling EventsApi->get_events: %s\n" % e) diff --git a/docs/GoalRelationshipsApi.md b/docs/GoalRelationshipsApi.md new file mode 100644 index 00000000..b0697e45 --- /dev/null +++ b/docs/GoalRelationshipsApi.md @@ -0,0 +1,277 @@ +# asana.GoalRelationshipsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_supporting_relationship**](GoalRelationshipsApi.md#add_supporting_relationship) | **POST** /goals/{goal_gid}/addSupportingRelationship | Add a supporting goal relationship +[**get_goal_relationship**](GoalRelationshipsApi.md#get_goal_relationship) | **GET** /goal_relationships/{goal_relationship_gid} | Get a goal relationship +[**get_goal_relationships**](GoalRelationshipsApi.md#get_goal_relationships) | **GET** /goal_relationships | Get goal relationships +[**remove_supporting_relationship**](GoalRelationshipsApi.md#remove_supporting_relationship) | **POST** /goals/{goal_gid}/removeSupportingRelationship | Removes a supporting goal relationship +[**update_goal_relationship**](GoalRelationshipsApi.md#update_goal_relationship) | **PUT** /goal_relationships/{goal_relationship_gid} | Update a goal relationship + +# **add_supporting_relationship** + +Add a supporting goal relationship + +Creates a goal relationship by adding a supporting resource to a given goal. Returns the newly created goal relationship record. + +([more information](https://developers.asana.com/reference/addsupportingrelationship)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The supporting resource to be added to the goal +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add a supporting goal relationship + api_response = goal_relationships_api_instance.add_supporting_relationship(body, goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalRelationshipsApi->add_supporting_relationship: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The supporting resource to be added to the goal | + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_goal_relationship** + +Get a goal relationship + +Returns the complete updated goal relationship record for a single goal relationship. + +([more information](https://developers.asana.com/reference/getgoalrelationship)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) +goal_relationship_gid = "12345" # str | Globally unique identifier for the goal relationship. +opts = { + 'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a goal relationship + api_response = goal_relationships_api_instance.get_goal_relationship(goal_relationship_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalRelationshipsApi->get_goal_relationship: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **goal_relationship_gid** | **str**| Globally unique identifier for the goal relationship. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_goal_relationships** + +Get goal relationships + +Returns compact goal relationship records. + +([more information](https://developers.asana.com/reference/getgoalrelationships)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) +supported_goal = "12345" # str | Globally unique identifier for the supported goal in the goal relationship. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'resource_subtype': "subgoal", # str | If provided, filter to goal relationships with a given resource_subtype. + 'opt_fields': "contribution_weight,offset,path,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get goal relationships + api_response = goal_relationships_api_instance.get_goal_relationships(supported_goal, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling GoalRelationshipsApi->get_goal_relationships: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **supported_goal** | **str**| Globally unique identifier for the supported goal in the goal relationship. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **resource_subtype** | **str**| If provided, filter to goal relationships with a given resource_subtype. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_supporting_relationship** + +Removes a supporting goal relationship + +Removes a goal relationship for a given parent goal. + +([more information](https://developers.asana.com/reference/removesupportingrelationship)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The supporting resource to be removed from the goal +goal_gid = "12345" # str | Globally unique identifier for the goal. + + +try: + # Removes a supporting goal relationship + api_response = goal_relationships_api_instance.remove_supporting_relationship(body, goal_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalRelationshipsApi->remove_supporting_relationship: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The supporting resource to be removed from the goal | + **goal_gid** | **str**| Globally unique identifier for the goal. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_goal_relationship** + +Update a goal relationship + +An existing goal relationship can be updated by making a PUT request on the URL for that goal relationship. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal relationship record. + +([more information](https://developers.asana.com/reference/updategoalrelationship)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the goal relationship. +goal_relationship_gid = "12345" # str | Globally unique identifier for the goal relationship. +opts = { + 'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a goal relationship + api_response = goal_relationships_api_instance.update_goal_relationship(body, goal_relationship_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalRelationshipsApi->update_goal_relationship: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the goal relationship. | + **goal_relationship_gid** | **str**| Globally unique identifier for the goal relationship. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/GoalRelationshipsApi.yaml b/docs/GoalRelationshipsApi.yaml new file mode 100644 index 00000000..3f46c607 --- /dev/null +++ b/docs/GoalRelationshipsApi.yaml @@ -0,0 +1,116 @@ +GoalRelationshipsApi: + add_supporting_relationship: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The supporting resource to be added to the goal + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add a supporting goal relationship + api_response = goal_relationships_api_instance.add_supporting_relationship(body, goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalRelationshipsApi->add_supporting_relationship: %s\n" % e) + get_goal_relationship: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) + goal_relationship_gid = "12345" # str | Globally unique identifier for the goal relationship. + opts = { + 'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a goal relationship + api_response = goal_relationships_api_instance.get_goal_relationship(goal_relationship_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalRelationshipsApi->get_goal_relationship: %s\n" % e) + get_goal_relationships: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) + supported_goal = "12345" # str | Globally unique identifier for the supported goal in the goal relationship. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'resource_subtype': "subgoal", # str | If provided, filter to goal relationships with a given resource_subtype. + 'opt_fields': "contribution_weight,offset,path,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get goal relationships + api_response = goal_relationships_api_instance.get_goal_relationships(supported_goal, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling GoalRelationshipsApi->get_goal_relationships: %s\n" % e) + remove_supporting_relationship: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The supporting resource to be removed from the goal + goal_gid = "12345" # str | Globally unique identifier for the goal. + + + try: + # Removes a supporting goal relationship + api_response = goal_relationships_api_instance.remove_supporting_relationship(body, goal_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalRelationshipsApi->remove_supporting_relationship: %s\n" % e) + update_goal_relationship: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goal_relationships_api_instance = asana.GoalRelationshipsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the goal relationship. + goal_relationship_gid = "12345" # str | Globally unique identifier for the goal relationship. + opts = { + 'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a goal relationship + api_response = goal_relationships_api_instance.update_goal_relationship(body, goal_relationship_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalRelationshipsApi->update_goal_relationship: %s\n" % e) diff --git a/docs/GoalsApi.md b/docs/GoalsApi.md new file mode 100644 index 00000000..6e2315da --- /dev/null +++ b/docs/GoalsApi.md @@ -0,0 +1,552 @@ +# asana.GoalsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_followers**](GoalsApi.md#add_followers) | **POST** /goals/{goal_gid}/addFollowers | Add a collaborator to a goal +[**create_goal**](GoalsApi.md#create_goal) | **POST** /goals | Create a goal +[**create_goal_metric**](GoalsApi.md#create_goal_metric) | **POST** /goals/{goal_gid}/setMetric | Create a goal metric +[**delete_goal**](GoalsApi.md#delete_goal) | **DELETE** /goals/{goal_gid} | Delete a goal +[**get_goal**](GoalsApi.md#get_goal) | **GET** /goals/{goal_gid} | Get a goal +[**get_goals**](GoalsApi.md#get_goals) | **GET** /goals | Get goals +[**get_parent_goals_for_goal**](GoalsApi.md#get_parent_goals_for_goal) | **GET** /goals/{goal_gid}/parentGoals | Get parent goals from a goal +[**remove_followers**](GoalsApi.md#remove_followers) | **POST** /goals/{goal_gid}/removeFollowers | Remove a collaborator from a goal +[**update_goal**](GoalsApi.md#update_goal) | **PUT** /goals/{goal_gid} | Update a goal +[**update_goal_metric**](GoalsApi.md#update_goal_metric) | **POST** /goals/{goal_gid}/setMetricCurrentValue | Update a goal metric + +# **add_followers** + +Add a collaborator to a goal + +Adds followers to a goal. Returns the goal the followers were added to. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above. + +([more information](https://developers.asana.com/reference/addfollowers)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to be added as collaborators +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add a collaborator to a goal + api_response = goals_api_instance.add_followers(body, goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->add_followers: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The followers to be added as collaborators | + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_goal** + +Create a goal + +Creates a new goal in a workspace or team. Returns the full record of the newly created goal. + +([more information](https://developers.asana.com/reference/creategoal)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The goal to create. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a goal + api_response = goals_api_instance.create_goal(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->create_goal: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The goal to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_goal_metric** + +Create a goal metric + +Creates and adds a goal metric to a specified goal. Note that this replaces an existing goal metric if one already exists. + +([more information](https://developers.asana.com/reference/creategoalmetric)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The goal metric to create. +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a goal metric + api_response = goals_api_instance.create_goal_metric(body, goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->create_goal_metric: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The goal metric to create. | + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_goal** + +Delete a goal + +A specific, existing goal can be deleted by making a DELETE request on the URL for that goal. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletegoal)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +goal_gid = "12345" # str | Globally unique identifier for the goal. + + +try: + # Delete a goal + api_response = goals_api_instance.delete_goal(goal_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->delete_goal: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **goal_gid** | **str**| Globally unique identifier for the goal. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_goal** + +Get a goal + +Returns the complete goal record for a single goal. + +([more information](https://developers.asana.com/reference/getgoal)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a goal + api_response = goals_api_instance.get_goal(goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->get_goal: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_goals** + +Get goals + +Returns compact goal records. + +([more information](https://developers.asana.com/reference/getgoals)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +opts = { + 'portfolio': "159874", # str | Globally unique identifier for supporting portfolio. + 'project': "512241", # str | Globally unique identifier for supporting project. + 'task': "78424", # str | Globally unique identifier for supporting task. + 'is_workspace_level': False, # bool | Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter. + 'team': "31326", # str | Globally unique identifier for the team. + 'workspace': "31326", # str | Globally unique identifier for the workspace. + 'time_periods': "221693,506165", # list[str] | Globally unique identifiers for the time periods. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,offset,owner,owner.name,path,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get goals + api_response = goals_api_instance.get_goals(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling GoalsApi->get_goals: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio** | **str**| Globally unique identifier for supporting portfolio. | [optional] + **project** | **str**| Globally unique identifier for supporting project. | [optional] + **task** | **str**| Globally unique identifier for supporting task. | [optional] + **is_workspace_level** | **bool**| Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter. | [optional] + **team** | **str**| Globally unique identifier for the team. | [optional] + **workspace** | **str**| Globally unique identifier for the workspace. | [optional] + **time_periods** | **Dict**| Globally unique identifiers for the time periods. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_parent_goals_for_goal** + +Get parent goals from a goal + +Returns a compact representation of all of the parent goals of a goal. + +([more information](https://developers.asana.com/reference/getparentgoalsforgoal)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get parent goals from a goal + api_response = goals_api_instance.get_parent_goals_for_goal(goal_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling GoalsApi->get_parent_goals_for_goal: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_followers** + +Remove a collaborator from a goal + +Removes followers from a goal. Returns the goal the followers were removed from. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above. + +([more information](https://developers.asana.com/reference/removefollowers)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to be removed as collaborators +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Remove a collaborator from a goal + api_response = goals_api_instance.remove_followers(body, goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->remove_followers: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The followers to be removed as collaborators | + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_goal** + +Update a goal + +An existing goal can be updated by making a PUT request on the URL for that goal. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal record. + +([more information](https://developers.asana.com/reference/updategoal)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the goal. +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a goal + api_response = goals_api_instance.update_goal(body, goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->update_goal: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the goal. | + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_goal_metric** + +Update a goal metric + +Updates a goal's existing metric's `current_number_value` if one exists, otherwise responds with a 400 status code. Returns the complete updated goal metric record. + +([more information](https://developers.asana.com/reference/updategoalmetric)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +goals_api_instance = asana.GoalsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the goal metric. +goal_gid = "12345" # str | Globally unique identifier for the goal. +opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a goal metric + api_response = goals_api_instance.update_goal_metric(body, goal_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling GoalsApi->update_goal_metric: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the goal metric. | + **goal_gid** | **str**| Globally unique identifier for the goal. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/GoalsApi.yaml b/docs/GoalsApi.yaml new file mode 100644 index 00000000..e93575d1 --- /dev/null +++ b/docs/GoalsApi.yaml @@ -0,0 +1,234 @@ +GoalsApi: + add_followers: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to be added as collaborators + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add a collaborator to a goal + api_response = goals_api_instance.add_followers(body, goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->add_followers: %s\n" % e) + create_goal: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The goal to create. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a goal + api_response = goals_api_instance.create_goal(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->create_goal: %s\n" % e) + create_goal_metric: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The goal metric to create. + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a goal metric + api_response = goals_api_instance.create_goal_metric(body, goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->create_goal_metric: %s\n" % e) + delete_goal: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + goal_gid = "12345" # str | Globally unique identifier for the goal. + + + try: + # Delete a goal + api_response = goals_api_instance.delete_goal(goal_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->delete_goal: %s\n" % e) + get_goal: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a goal + api_response = goals_api_instance.get_goal(goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->get_goal: %s\n" % e) + get_goals: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + opts = { + 'portfolio': "159874", # str | Globally unique identifier for supporting portfolio. + 'project': "512241", # str | Globally unique identifier for supporting project. + 'task': "78424", # str | Globally unique identifier for supporting task. + 'is_workspace_level': False, # bool | Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter. + 'team': "31326", # str | Globally unique identifier for the team. + 'workspace': "31326", # str | Globally unique identifier for the workspace. + 'time_periods': "221693,506165", # list[str] | Globally unique identifiers for the time periods. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,offset,owner,owner.name,path,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get goals + api_response = goals_api_instance.get_goals(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling GoalsApi->get_goals: %s\n" % e) + get_parent_goals_for_goal: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get parent goals from a goal + api_response = goals_api_instance.get_parent_goals_for_goal(goal_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling GoalsApi->get_parent_goals_for_goal: %s\n" % e) + remove_followers: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to be removed as collaborators + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Remove a collaborator from a goal + api_response = goals_api_instance.remove_followers(body, goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->remove_followers: %s\n" % e) + update_goal: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the goal. + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a goal + api_response = goals_api_instance.update_goal(body, goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->update_goal: %s\n" % e) + update_goal_metric: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + goals_api_instance = asana.GoalsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the goal metric. + goal_gid = "12345" # str | Globally unique identifier for the goal. + opts = { + 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,owner,owner.name,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a goal metric + api_response = goals_api_instance.update_goal_metric(body, goal_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling GoalsApi->update_goal_metric: %s\n" % e) diff --git a/docs/JobsApi.md b/docs/JobsApi.md new file mode 100644 index 00000000..53dd4abf --- /dev/null +++ b/docs/JobsApi.md @@ -0,0 +1,59 @@ +# asana.JobsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_job**](JobsApi.md#get_job) | **GET** /jobs/{job_gid} | Get a job by id + +# **get_job** + +Get a job by id + +Returns the full record for a job. + +([more information](https://developers.asana.com/reference/getjob)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +jobs_api_instance = asana.JobsApi(api_client) +job_gid = "12345" # str | Globally unique identifier for the job. +opts = { + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a job by id + api_response = jobs_api_instance.get_job(job_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling JobsApi->get_job: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **job_gid** | **str**| Globally unique identifier for the job. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/JobsApi.yaml b/docs/JobsApi.yaml new file mode 100644 index 00000000..ad231d92 --- /dev/null +++ b/docs/JobsApi.yaml @@ -0,0 +1,23 @@ +JobsApi: + get_job: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + jobs_api_instance = asana.JobsApi(api_client) + job_gid = "12345" # str | Globally unique identifier for the job. + opts = { + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a job by id + api_response = jobs_api_instance.get_job(job_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling JobsApi->get_job: %s\n" % e) diff --git a/docs/MembershipsApi.md b/docs/MembershipsApi.md new file mode 100644 index 00000000..dde8dafa --- /dev/null +++ b/docs/MembershipsApi.md @@ -0,0 +1,217 @@ +# asana.MembershipsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_membership**](MembershipsApi.md#create_membership) | **POST** /memberships | Create a membership +[**delete_membership**](MembershipsApi.md#delete_membership) | **DELETE** /memberships/{membership_gid} | Delete a membership +[**get_membership**](MembershipsApi.md#get_membership) | **GET** /memberships/{membership_gid} | Get a membership +[**get_memberships**](MembershipsApi.md#get_memberships) | **GET** /memberships | Get multiple memberships + +# **create_membership** + +Create a membership + +Creates a new membership in a `goal`. `Teams` or `users` can be a member of `goals`. Returns the full record of the newly created membership. + +([more information](https://developers.asana.com/reference/createmembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +memberships_api_instance = asana.MembershipsApi(api_client) +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the membership. +} + +try: + # Create a membership + api_response = memberships_api_instance.create_membership(opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling MembershipsApi->create_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the membership. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_membership** + +Delete a membership + +A specific, existing membership can be deleted by making a `DELETE` request on the URL for that membership. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletemembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +memberships_api_instance = asana.MembershipsApi(api_client) +membership_gid = "12345" # str | Globally unique identifier for the membership. + + +try: + # Delete a membership + api_response = memberships_api_instance.delete_membership(membership_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling MembershipsApi->delete_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **membership_gid** | **str**| Globally unique identifier for the membership. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_membership** + +Get a membership + +Returns compact `project_membership` record for a single membership. `GET` only supports project memberships currently + +([more information](https://developers.asana.com/reference/getmembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +memberships_api_instance = asana.MembershipsApi(api_client) +membership_gid = "12345" # str | Globally unique identifier for the membership. +opts = { + 'opt_fields': "access_level,member,member.name,parent,parent.name,resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a membership + api_response = memberships_api_instance.get_membership(membership_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling MembershipsApi->get_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **membership_gid** | **str**| Globally unique identifier for the membership. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_memberships** + +Get multiple memberships + +Returns compact `goal_membership` or `project_membership` records. The possible types for `parent` in this request are `goal` or `project`. An additional member (user GID or team GID) can be passed in to filter to a specific membership. + +([more information](https://developers.asana.com/reference/getmemberships)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +memberships_api_instance = asana.MembershipsApi(api_client) +opts = { + 'parent': "159874", # str | Globally unique identifier for `goal` or `project`. + 'member': "1061493", # str | Globally unique identifier for `team` or `user`. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple memberships + api_response = memberships_api_instance.get_memberships(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling MembershipsApi->get_memberships: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **parent** | **str**| Globally unique identifier for `goal` or `project`. | [optional] + **member** | **str**| Globally unique identifier for `team` or `user`. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/MembershipsApi.yaml b/docs/MembershipsApi.yaml new file mode 100644 index 00000000..0f4b4a4f --- /dev/null +++ b/docs/MembershipsApi.yaml @@ -0,0 +1,90 @@ +MembershipsApi: + create_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + memberships_api_instance = asana.MembershipsApi(api_client) + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the membership. + } + + try: + # Create a membership + api_response = memberships_api_instance.create_membership(opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling MembershipsApi->create_membership: %s\n" % e) + delete_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + memberships_api_instance = asana.MembershipsApi(api_client) + membership_gid = "12345" # str | Globally unique identifier for the membership. + + + try: + # Delete a membership + api_response = memberships_api_instance.delete_membership(membership_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling MembershipsApi->delete_membership: %s\n" % e) + get_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + memberships_api_instance = asana.MembershipsApi(api_client) + membership_gid = "12345" # str | Globally unique identifier for the membership. + opts = { + 'opt_fields': "access_level,member,member.name,parent,parent.name,resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a membership + api_response = memberships_api_instance.get_membership(membership_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling MembershipsApi->get_membership: %s\n" % e) + get_memberships: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + memberships_api_instance = asana.MembershipsApi(api_client) + opts = { + 'parent': "159874", # str | Globally unique identifier for `goal` or `project`. + 'member': "1061493", # str | Globally unique identifier for `team` or `user`. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple memberships + api_response = memberships_api_instance.get_memberships(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling MembershipsApi->get_memberships: %s\n" % e) diff --git a/docs/OrganizationExportsApi.md b/docs/OrganizationExportsApi.md new file mode 100644 index 00000000..ca412236 --- /dev/null +++ b/docs/OrganizationExportsApi.md @@ -0,0 +1,111 @@ +# asana.OrganizationExportsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_organization_export**](OrganizationExportsApi.md#create_organization_export) | **POST** /organization_exports | Create an organization export request +[**get_organization_export**](OrganizationExportsApi.md#get_organization_export) | **GET** /organization_exports/{organization_export_gid} | Get details on an org export request + +# **create_organization_export** + +Create an organization export request + +This method creates a request to export an Organization. Asana will complete the export at some point after you create the request. + +([more information](https://developers.asana.com/reference/createorganizationexport)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +organization_exports_api_instance = asana.OrganizationExportsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The organization to export. +opts = { + 'opt_fields': "created_at,download_url,organization,organization.name,state" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create an organization export request + api_response = organization_exports_api_instance.create_organization_export(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling OrganizationExportsApi->create_organization_export: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The organization to export. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_organization_export** + +Get details on an org export request + +Returns details of a previously-requested Organization export. + +([more information](https://developers.asana.com/reference/getorganizationexport)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +organization_exports_api_instance = asana.OrganizationExportsApi(api_client) +organization_export_gid = "12345" # str | Globally unique identifier for the organization export. +opts = { + 'opt_fields': "created_at,download_url,organization,organization.name,state" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get details on an org export request + api_response = organization_exports_api_instance.get_organization_export(organization_export_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling OrganizationExportsApi->get_organization_export: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **organization_export_gid** | **str**| Globally unique identifier for the organization export. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/OrganizationExportsApi.yaml b/docs/OrganizationExportsApi.yaml new file mode 100644 index 00000000..d52ae209 --- /dev/null +++ b/docs/OrganizationExportsApi.yaml @@ -0,0 +1,45 @@ +OrganizationExportsApi: + create_organization_export: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + organization_exports_api_instance = asana.OrganizationExportsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The organization to export. + opts = { + 'opt_fields': "created_at,download_url,organization,organization.name,state" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create an organization export request + api_response = organization_exports_api_instance.create_organization_export(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling OrganizationExportsApi->create_organization_export: %s\n" % e) + get_organization_export: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + organization_exports_api_instance = asana.OrganizationExportsApi(api_client) + organization_export_gid = "12345" # str | Globally unique identifier for the organization export. + opts = { + 'opt_fields': "created_at,download_url,organization,organization.name,state" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get details on an org export request + api_response = organization_exports_api_instance.get_organization_export(organization_export_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling OrganizationExportsApi->get_organization_export: %s\n" % e) diff --git a/docs/PortfolioMembershipsApi.md b/docs/PortfolioMembershipsApi.md new file mode 100644 index 00000000..1b1fa5a0 --- /dev/null +++ b/docs/PortfolioMembershipsApi.md @@ -0,0 +1,179 @@ +# asana.PortfolioMembershipsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_portfolio_membership**](PortfolioMembershipsApi.md#get_portfolio_membership) | **GET** /portfolio_memberships/{portfolio_membership_gid} | Get a portfolio membership +[**get_portfolio_memberships**](PortfolioMembershipsApi.md#get_portfolio_memberships) | **GET** /portfolio_memberships | Get multiple portfolio memberships +[**get_portfolio_memberships_for_portfolio**](PortfolioMembershipsApi.md#get_portfolio_memberships_for_portfolio) | **GET** /portfolios/{portfolio_gid}/portfolio_memberships | Get memberships from a portfolio + +# **get_portfolio_membership** + +Get a portfolio membership + +Returns the complete portfolio record for a single portfolio membership. + +([more information](https://developers.asana.com/reference/getportfoliomembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolio_memberships_api_instance = asana.PortfolioMembershipsApi(api_client) +portfolio_membership_gid = "1331" # str | +opts = { + 'opt_fields': "portfolio,portfolio.name,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a portfolio membership + api_response = portfolio_memberships_api_instance.get_portfolio_membership(portfolio_membership_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfolioMembershipsApi->get_portfolio_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio_membership_gid** | **str**| | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_portfolio_memberships** + +Get multiple portfolio memberships + +Returns a list of portfolio memberships in compact representation. You must specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`. + +([more information](https://developers.asana.com/reference/getportfoliomemberships)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolio_memberships_api_instance = asana.PortfolioMembershipsApi(api_client) +opts = { + 'portfolio': "12345", # str | The portfolio to filter results on. + 'workspace': "12345", # str | The workspace to filter results on. + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "offset,path,portfolio,portfolio.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple portfolio memberships + api_response = portfolio_memberships_api_instance.get_portfolio_memberships(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling PortfolioMembershipsApi->get_portfolio_memberships: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio** | **str**| The portfolio to filter results on. | [optional] + **workspace** | **str**| The workspace to filter results on. | [optional] + **user** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_portfolio_memberships_for_portfolio** + +Get memberships from a portfolio + +Returns the compact portfolio membership records for the portfolio. + +([more information](https://developers.asana.com/reference/getportfoliomembershipsforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolio_memberships_api_instance = asana.PortfolioMembershipsApi(api_client) +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "offset,path,portfolio,portfolio.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get memberships from a portfolio + api_response = portfolio_memberships_api_instance.get_portfolio_memberships_for_portfolio(portfolio_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling PortfolioMembershipsApi->get_portfolio_memberships_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **user** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PortfolioMembershipsApi.yaml b/docs/PortfolioMembershipsApi.yaml new file mode 100644 index 00000000..6daae795 --- /dev/null +++ b/docs/PortfolioMembershipsApi.yaml @@ -0,0 +1,76 @@ +PortfolioMembershipsApi: + get_portfolio_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolio_memberships_api_instance = asana.PortfolioMembershipsApi(api_client) + portfolio_membership_gid = "1331" # str | + opts = { + 'opt_fields': "portfolio,portfolio.name,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a portfolio membership + api_response = portfolio_memberships_api_instance.get_portfolio_membership(portfolio_membership_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfolioMembershipsApi->get_portfolio_membership: %s\n" % e) + get_portfolio_memberships: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolio_memberships_api_instance = asana.PortfolioMembershipsApi(api_client) + opts = { + 'portfolio': "12345", # str | The portfolio to filter results on. + 'workspace': "12345", # str | The workspace to filter results on. + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "offset,path,portfolio,portfolio.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple portfolio memberships + api_response = portfolio_memberships_api_instance.get_portfolio_memberships(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling PortfolioMembershipsApi->get_portfolio_memberships: %s\n" % e) + get_portfolio_memberships_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolio_memberships_api_instance = asana.PortfolioMembershipsApi(api_client) + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "offset,path,portfolio,portfolio.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get memberships from a portfolio + api_response = portfolio_memberships_api_instance.get_portfolio_memberships_for_portfolio(portfolio_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling PortfolioMembershipsApi->get_portfolio_memberships_for_portfolio: %s\n" % e) diff --git a/docs/PortfoliosApi.md b/docs/PortfoliosApi.md new file mode 100644 index 00000000..e5a9641c --- /dev/null +++ b/docs/PortfoliosApi.md @@ -0,0 +1,642 @@ +# asana.PortfoliosApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_custom_field_setting_for_portfolio**](PortfoliosApi.md#add_custom_field_setting_for_portfolio) | **POST** /portfolios/{portfolio_gid}/addCustomFieldSetting | Add a custom field to a portfolio +[**add_item_for_portfolio**](PortfoliosApi.md#add_item_for_portfolio) | **POST** /portfolios/{portfolio_gid}/addItem | Add a portfolio item +[**add_members_for_portfolio**](PortfoliosApi.md#add_members_for_portfolio) | **POST** /portfolios/{portfolio_gid}/addMembers | Add users to a portfolio +[**create_portfolio**](PortfoliosApi.md#create_portfolio) | **POST** /portfolios | Create a portfolio +[**delete_portfolio**](PortfoliosApi.md#delete_portfolio) | **DELETE** /portfolios/{portfolio_gid} | Delete a portfolio +[**get_items_for_portfolio**](PortfoliosApi.md#get_items_for_portfolio) | **GET** /portfolios/{portfolio_gid}/items | Get portfolio items +[**get_portfolio**](PortfoliosApi.md#get_portfolio) | **GET** /portfolios/{portfolio_gid} | Get a portfolio +[**get_portfolios**](PortfoliosApi.md#get_portfolios) | **GET** /portfolios | Get multiple portfolios +[**remove_custom_field_setting_for_portfolio**](PortfoliosApi.md#remove_custom_field_setting_for_portfolio) | **POST** /portfolios/{portfolio_gid}/removeCustomFieldSetting | Remove a custom field from a portfolio +[**remove_item_for_portfolio**](PortfoliosApi.md#remove_item_for_portfolio) | **POST** /portfolios/{portfolio_gid}/removeItem | Remove a portfolio item +[**remove_members_for_portfolio**](PortfoliosApi.md#remove_members_for_portfolio) | **POST** /portfolios/{portfolio_gid}/removeMembers | Remove users from a portfolio +[**update_portfolio**](PortfoliosApi.md#update_portfolio) | **PUT** /portfolios/{portfolio_gid} | Update a portfolio + +# **add_custom_field_setting_for_portfolio** + +Add a custom field to a portfolio + +Custom fields are associated with portfolios by way of custom field settings. This method creates a setting for the portfolio. + +([more information](https://developers.asana.com/reference/addcustomfieldsettingforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + +try: + # Add a custom field to a portfolio + api_response = portfolios_api_instance.add_custom_field_setting_for_portfolio(body, portfolio_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->add_custom_field_setting_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the custom field setting. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_item_for_portfolio** + +Add a portfolio item + +Add an item to a portfolio. Returns an empty data block. + +([more information](https://developers.asana.com/reference/additemforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the item being inserted. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + +try: + # Add a portfolio item + api_response = portfolios_api_instance.add_item_for_portfolio(body, portfolio_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->add_item_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the item being inserted. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_members_for_portfolio** + +Add users to a portfolio + +Adds the specified list of users as members of the portfolio. Returns the updated portfolio record. + +([more information](https://developers.asana.com/reference/addmembersforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being added. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add users to a portfolio + api_response = portfolios_api_instance.add_members_for_portfolio(body, portfolio_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->add_members_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the members being added. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_portfolio** + +Create a portfolio + +Creates a new portfolio in the given workspace with the supplied name. Note that portfolios created in the Asana UI may have some state (like the “Priority” custom field) which is automatically added to the portfolio when it is created. Portfolios created via our API will *not* be created with the same initial state to allow integrations to create their own starting state on a portfolio. + +([more information](https://developers.asana.com/reference/createportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The portfolio to create. +opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a portfolio + api_response = portfolios_api_instance.create_portfolio(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->create_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The portfolio to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_portfolio** + +Delete a portfolio + +An existing portfolio can be deleted by making a DELETE request on the URL for that portfolio. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deleteportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + +try: + # Delete a portfolio + api_response = portfolios_api_instance.delete_portfolio(portfolio_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->delete_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_items_for_portfolio** + +Get portfolio items + +Get a list of the items in compact form in a portfolio. + +([more information](https://developers.asana.com/reference/getitemsforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get portfolio items + api_response = portfolios_api_instance.get_items_for_portfolio(portfolio_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling PortfoliosApi->get_items_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_portfolio** + +Get a portfolio + +Returns the complete portfolio record for a single portfolio. + +([more information](https://developers.asana.com/reference/getportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a portfolio + api_response = portfolios_api_instance.get_portfolio(portfolio_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->get_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_portfolios** + +Get multiple portfolios + +Returns a list of the portfolios in compact representation that are owned by the current API user. + +([more information](https://developers.asana.com/reference/getportfolios)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +workspace = "1331" # str | The workspace or organization to filter portfolios on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'owner': "14916", # str | The user who owns the portfolio. Currently, API users can only get a list of portfolios that they themselves own, unless the request is made from a Service Account. In the case of a Service Account, if this parameter is specified, then all portfolios owned by this parameter are returned. Otherwise, all portfolios across the workspace are returned. + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,offset,owner,owner.name,path,permalink_url,project_templates,project_templates.name,public,start_on,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple portfolios + api_response = portfolios_api_instance.get_portfolios(workspace, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling PortfoliosApi->get_portfolios: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace** | **str**| The workspace or organization to filter portfolios on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **owner** | **str**| The user who owns the portfolio. Currently, API users can only get a list of portfolios that they themselves own, unless the request is made from a Service Account. In the case of a Service Account, if this parameter is specified, then all portfolios owned by this parameter are returned. Otherwise, all portfolios across the workspace are returned. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_custom_field_setting_for_portfolio** + +Remove a custom field from a portfolio + +Removes a custom field setting from a portfolio. + +([more information](https://developers.asana.com/reference/removecustomfieldsettingforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting being removed. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + +try: + # Remove a custom field from a portfolio + api_response = portfolios_api_instance.remove_custom_field_setting_for_portfolio(body, portfolio_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->remove_custom_field_setting_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the custom field setting being removed. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_item_for_portfolio** + +Remove a portfolio item + +Remove an item from a portfolio. Returns an empty data block. + +([more information](https://developers.asana.com/reference/removeitemforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the item being removed. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + +try: + # Remove a portfolio item + api_response = portfolios_api_instance.remove_item_for_portfolio(body, portfolio_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->remove_item_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the item being removed. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_members_for_portfolio** + +Remove users from a portfolio + +Removes the specified list of users from members of the portfolio. Returns the updated portfolio record. + +([more information](https://developers.asana.com/reference/removemembersforportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being removed. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Remove users from a portfolio + api_response = portfolios_api_instance.remove_members_for_portfolio(body, portfolio_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->remove_members_for_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the members being removed. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_portfolio** + +Update a portfolio + +An existing portfolio can be updated by making a PUT request on the URL for that portfolio. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated portfolio record. + +([more information](https://developers.asana.com/reference/updateportfolio)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +portfolios_api_instance = asana.PortfoliosApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the portfolio. +portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. +opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a portfolio + api_response = portfolios_api_instance.update_portfolio(body, portfolio_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling PortfoliosApi->update_portfolio: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the portfolio. | + **portfolio_gid** | **str**| Globally unique identifier for the portfolio. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PortfoliosApi.yaml b/docs/PortfoliosApi.yaml new file mode 100644 index 00000000..28658cd8 --- /dev/null +++ b/docs/PortfoliosApi.yaml @@ -0,0 +1,269 @@ +PortfoliosApi: + add_custom_field_setting_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + + try: + # Add a custom field to a portfolio + api_response = portfolios_api_instance.add_custom_field_setting_for_portfolio(body, portfolio_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->add_custom_field_setting_for_portfolio: %s\n" % e) + add_item_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the item being inserted. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + + try: + # Add a portfolio item + api_response = portfolios_api_instance.add_item_for_portfolio(body, portfolio_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->add_item_for_portfolio: %s\n" % e) + add_members_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being added. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add users to a portfolio + api_response = portfolios_api_instance.add_members_for_portfolio(body, portfolio_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->add_members_for_portfolio: %s\n" % e) + create_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The portfolio to create. + opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a portfolio + api_response = portfolios_api_instance.create_portfolio(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->create_portfolio: %s\n" % e) + delete_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + + try: + # Delete a portfolio + api_response = portfolios_api_instance.delete_portfolio(portfolio_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->delete_portfolio: %s\n" % e) + get_items_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get portfolio items + api_response = portfolios_api_instance.get_items_for_portfolio(portfolio_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling PortfoliosApi->get_items_for_portfolio: %s\n" % e) + get_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a portfolio + api_response = portfolios_api_instance.get_portfolio(portfolio_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->get_portfolio: %s\n" % e) + get_portfolios: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + workspace = "1331" # str | The workspace or organization to filter portfolios on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'owner': "14916", # str | The user who owns the portfolio. Currently, API users can only get a list of portfolios that they themselves own, unless the request is made from a Service Account. In the case of a Service Account, if this parameter is specified, then all portfolios owned by this parameter are returned. Otherwise, all portfolios across the workspace are returned. + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,offset,owner,owner.name,path,permalink_url,project_templates,project_templates.name,public,start_on,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple portfolios + api_response = portfolios_api_instance.get_portfolios(workspace, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling PortfoliosApi->get_portfolios: %s\n" % e) + remove_custom_field_setting_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting being removed. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + + try: + # Remove a custom field from a portfolio + api_response = portfolios_api_instance.remove_custom_field_setting_for_portfolio(body, portfolio_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->remove_custom_field_setting_for_portfolio: %s\n" % e) + remove_item_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the item being removed. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + + + try: + # Remove a portfolio item + api_response = portfolios_api_instance.remove_item_for_portfolio(body, portfolio_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->remove_item_for_portfolio: %s\n" % e) + remove_members_for_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being removed. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Remove users from a portfolio + api_response = portfolios_api_instance.remove_members_for_portfolio(body, portfolio_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->remove_members_for_portfolio: %s\n" % e) + update_portfolio: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + portfolios_api_instance = asana.PortfoliosApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the portfolio. + portfolio_gid = "12345" # str | Globally unique identifier for the portfolio. + opts = { + 'opt_fields': "color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,due_on,members,members.name,name,owner,owner.name,permalink_url,project_templates,project_templates.name,public,start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a portfolio + api_response = portfolios_api_instance.update_portfolio(body, portfolio_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling PortfoliosApi->update_portfolio: %s\n" % e) diff --git a/docs/ProjectBriefsApi.md b/docs/ProjectBriefsApi.md new file mode 100644 index 00000000..b254a498 --- /dev/null +++ b/docs/ProjectBriefsApi.md @@ -0,0 +1,216 @@ +# asana.ProjectBriefsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_project_brief**](ProjectBriefsApi.md#create_project_brief) | **POST** /projects/{project_gid}/project_briefs | Create a project brief +[**delete_project_brief**](ProjectBriefsApi.md#delete_project_brief) | **DELETE** /project_briefs/{project_brief_gid} | Delete a project brief +[**get_project_brief**](ProjectBriefsApi.md#get_project_brief) | **GET** /project_briefs/{project_brief_gid} | Get a project brief +[**update_project_brief**](ProjectBriefsApi.md#update_project_brief) | **PUT** /project_briefs/{project_brief_gid} | Update a project brief + +# **create_project_brief** + +Create a project brief + +Creates a new project brief. Returns the full record of the newly created project brief. + +([more information](https://developers.asana.com/reference/createprojectbrief)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_briefs_api_instance = asana.ProjectBriefsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project brief to create. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "html_text,permalink_url,project,project.name,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a project brief + api_response = project_briefs_api_instance.create_project_brief(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectBriefsApi->create_project_brief: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The project brief to create. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_project_brief** + +Delete a project brief + +Deletes a specific, existing project brief. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deleteprojectbrief)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_briefs_api_instance = asana.ProjectBriefsApi(api_client) +project_brief_gid = "12345" # str | Globally unique identifier for the project brief. + + +try: + # Delete a project brief + api_response = project_briefs_api_instance.delete_project_brief(project_brief_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectBriefsApi->delete_project_brief: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_brief_gid** | **str**| Globally unique identifier for the project brief. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_brief** + +Get a project brief + +Get the full record for a project brief. + +([more information](https://developers.asana.com/reference/getprojectbrief)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_briefs_api_instance = asana.ProjectBriefsApi(api_client) +project_brief_gid = "12345" # str | Globally unique identifier for the project brief. +opts = { + 'opt_fields': "html_text,permalink_url,project,project.name,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a project brief + api_response = project_briefs_api_instance.get_project_brief(project_brief_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectBriefsApi->get_project_brief: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_brief_gid** | **str**| Globally unique identifier for the project brief. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_project_brief** + +Update a project brief + +An existing project brief can be updated by making a PUT request on the URL for that project brief. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Returns the complete updated project brief record. + +([more information](https://developers.asana.com/reference/updateprojectbrief)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_briefs_api_instance = asana.ProjectBriefsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the project brief. +project_brief_gid = "12345" # str | Globally unique identifier for the project brief. +opts = { + 'opt_fields': "html_text,permalink_url,project,project.name,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a project brief + api_response = project_briefs_api_instance.update_project_brief(body, project_brief_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectBriefsApi->update_project_brief: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the project brief. | + **project_brief_gid** | **str**| Globally unique identifier for the project brief. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProjectBriefsApi.yaml b/docs/ProjectBriefsApi.yaml new file mode 100644 index 00000000..9a1954f7 --- /dev/null +++ b/docs/ProjectBriefsApi.yaml @@ -0,0 +1,89 @@ +ProjectBriefsApi: + create_project_brief: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_briefs_api_instance = asana.ProjectBriefsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project brief to create. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "html_text,permalink_url,project,project.name,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a project brief + api_response = project_briefs_api_instance.create_project_brief(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectBriefsApi->create_project_brief: %s\n" % e) + delete_project_brief: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_briefs_api_instance = asana.ProjectBriefsApi(api_client) + project_brief_gid = "12345" # str | Globally unique identifier for the project brief. + + + try: + # Delete a project brief + api_response = project_briefs_api_instance.delete_project_brief(project_brief_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectBriefsApi->delete_project_brief: %s\n" % e) + get_project_brief: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_briefs_api_instance = asana.ProjectBriefsApi(api_client) + project_brief_gid = "12345" # str | Globally unique identifier for the project brief. + opts = { + 'opt_fields': "html_text,permalink_url,project,project.name,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a project brief + api_response = project_briefs_api_instance.get_project_brief(project_brief_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectBriefsApi->get_project_brief: %s\n" % e) + update_project_brief: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_briefs_api_instance = asana.ProjectBriefsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the project brief. + project_brief_gid = "12345" # str | Globally unique identifier for the project brief. + opts = { + 'opt_fields': "html_text,permalink_url,project,project.name,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a project brief + api_response = project_briefs_api_instance.update_project_brief(body, project_brief_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectBriefsApi->update_project_brief: %s\n" % e) diff --git a/docs/ProjectMembershipsApi.md b/docs/ProjectMembershipsApi.md new file mode 100644 index 00000000..d88767f3 --- /dev/null +++ b/docs/ProjectMembershipsApi.md @@ -0,0 +1,118 @@ +# asana.ProjectMembershipsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_project_membership**](ProjectMembershipsApi.md#get_project_membership) | **GET** /project_memberships/{project_membership_gid} | Get a project membership +[**get_project_memberships_for_project**](ProjectMembershipsApi.md#get_project_memberships_for_project) | **GET** /projects/{project_gid}/project_memberships | Get memberships from a project + +# **get_project_membership** + +Get a project membership + +Returns the complete project record for a single project membership. + +([more information](https://developers.asana.com/reference/getprojectmembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_memberships_api_instance = asana.ProjectMembershipsApi(api_client) +project_membership_gid = "1331" # str | +opts = { + 'opt_fields': "access_level,member,member.name,parent,parent.name,project,project.name,user,user.name,write_access" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a project membership + api_response = project_memberships_api_instance.get_project_membership(project_membership_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectMembershipsApi->get_project_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_membership_gid** | **str**| | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_memberships_for_project** + +Get memberships from a project + +Returns the compact project membership records for the project. + +([more information](https://developers.asana.com/reference/getprojectmembershipsforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_memberships_api_instance = asana.ProjectMembershipsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "access_level,member,member.name,offset,parent,parent.name,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get memberships from a project + api_response = project_memberships_api_instance.get_project_memberships_for_project(project_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectMembershipsApi->get_project_memberships_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **user** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProjectMembershipsApi.yaml b/docs/ProjectMembershipsApi.yaml new file mode 100644 index 00000000..856fc92a --- /dev/null +++ b/docs/ProjectMembershipsApi.yaml @@ -0,0 +1,49 @@ +ProjectMembershipsApi: + get_project_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_memberships_api_instance = asana.ProjectMembershipsApi(api_client) + project_membership_gid = "1331" # str | + opts = { + 'opt_fields': "access_level,member,member.name,parent,parent.name,project,project.name,user,user.name,write_access" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a project membership + api_response = project_memberships_api_instance.get_project_membership(project_membership_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectMembershipsApi->get_project_membership: %s\n" % e) + get_project_memberships_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_memberships_api_instance = asana.ProjectMembershipsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "access_level,member,member.name,offset,parent,parent.name,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get memberships from a project + api_response = project_memberships_api_instance.get_project_memberships_for_project(project_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectMembershipsApi->get_project_memberships_for_project: %s\n" % e) diff --git a/docs/ProjectStatusesApi.md b/docs/ProjectStatusesApi.md new file mode 100644 index 00000000..7bd63ebe --- /dev/null +++ b/docs/ProjectStatusesApi.md @@ -0,0 +1,219 @@ +# asana.ProjectStatusesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_project_status_for_project**](ProjectStatusesApi.md#create_project_status_for_project) | **POST** /projects/{project_gid}/project_statuses | Create a project status +[**delete_project_status**](ProjectStatusesApi.md#delete_project_status) | **DELETE** /project_statuses/{project_status_gid} | Delete a project status +[**get_project_status**](ProjectStatusesApi.md#get_project_status) | **GET** /project_statuses/{project_status_gid} | Get a project status +[**get_project_statuses_for_project**](ProjectStatusesApi.md#get_project_statuses_for_project) | **GET** /projects/{project_gid}/project_statuses | Get statuses from a project + +# **create_project_status_for_project** + +Create a project status + +*Deprecated: new integrations should prefer the `/status_updates` route.* Creates a new status update on the project. Returns the full record of the newly created project status update. + +([more information](https://developers.asana.com/reference/createprojectstatusforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_statuses_api_instance = asana.ProjectStatusesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project status to create. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "author,author.name,color,created_at,created_by,created_by.name,html_text,modified_at,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a project status + api_response = project_statuses_api_instance.create_project_status_for_project(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectStatusesApi->create_project_status_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The project status to create. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_project_status** + +Delete a project status + +*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Deletes a specific, existing project status update. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deleteprojectstatus)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_statuses_api_instance = asana.ProjectStatusesApi(api_client) +project_status_gid = "321654" # str | The project status update to get. + + +try: + # Delete a project status + api_response = project_statuses_api_instance.delete_project_status(project_status_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectStatusesApi->delete_project_status: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_status_gid** | **str**| The project status update to get. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_status** + +Get a project status + +*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Returns the complete record for a single status update. + +([more information](https://developers.asana.com/reference/getprojectstatus)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_statuses_api_instance = asana.ProjectStatusesApi(api_client) +project_status_gid = "321654" # str | The project status update to get. +opts = { + 'opt_fields': "author,author.name,color,created_at,created_by,created_by.name,html_text,modified_at,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a project status + api_response = project_statuses_api_instance.get_project_status(project_status_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectStatusesApi->get_project_status: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_status_gid** | **str**| The project status update to get. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_statuses_for_project** + +Get statuses from a project + +*Deprecated: new integrations should prefer the `/status_updates` route.* Returns the compact project status update records for all updates on the project. + +([more information](https://developers.asana.com/reference/getprojectstatusesforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_statuses_api_instance = asana.ProjectStatusesApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "author,author.name,color,created_at,created_by,created_by.name,html_text,modified_at,offset,path,text,title,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get statuses from a project + api_response = project_statuses_api_instance.get_project_statuses_for_project(project_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectStatusesApi->get_project_statuses_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProjectStatusesApi.yaml b/docs/ProjectStatusesApi.yaml new file mode 100644 index 00000000..b5631177 --- /dev/null +++ b/docs/ProjectStatusesApi.yaml @@ -0,0 +1,91 @@ +ProjectStatusesApi: + create_project_status_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_statuses_api_instance = asana.ProjectStatusesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project status to create. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "author,author.name,color,created_at,created_by,created_by.name,html_text,modified_at,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a project status + api_response = project_statuses_api_instance.create_project_status_for_project(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectStatusesApi->create_project_status_for_project: %s\n" % e) + delete_project_status: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_statuses_api_instance = asana.ProjectStatusesApi(api_client) + project_status_gid = "321654" # str | The project status update to get. + + + try: + # Delete a project status + api_response = project_statuses_api_instance.delete_project_status(project_status_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectStatusesApi->delete_project_status: %s\n" % e) + get_project_status: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_statuses_api_instance = asana.ProjectStatusesApi(api_client) + project_status_gid = "321654" # str | The project status update to get. + opts = { + 'opt_fields': "author,author.name,color,created_at,created_by,created_by.name,html_text,modified_at,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a project status + api_response = project_statuses_api_instance.get_project_status(project_status_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectStatusesApi->get_project_status: %s\n" % e) + get_project_statuses_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_statuses_api_instance = asana.ProjectStatusesApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "author,author.name,color,created_at,created_by,created_by.name,html_text,modified_at,offset,path,text,title,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get statuses from a project + api_response = project_statuses_api_instance.get_project_statuses_for_project(project_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectStatusesApi->get_project_statuses_for_project: %s\n" % e) diff --git a/docs/ProjectTemplatesApi.md b/docs/ProjectTemplatesApi.md new file mode 100644 index 00000000..590ef10a --- /dev/null +++ b/docs/ProjectTemplatesApi.md @@ -0,0 +1,278 @@ +# asana.ProjectTemplatesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**delete_project_template**](ProjectTemplatesApi.md#delete_project_template) | **DELETE** /project_templates/{project_template_gid} | Delete a project template +[**get_project_template**](ProjectTemplatesApi.md#get_project_template) | **GET** /project_templates/{project_template_gid} | Get a project template +[**get_project_templates**](ProjectTemplatesApi.md#get_project_templates) | **GET** /project_templates | Get multiple project templates +[**get_project_templates_for_team**](ProjectTemplatesApi.md#get_project_templates_for_team) | **GET** /teams/{team_gid}/project_templates | Get a team's project templates +[**instantiate_project**](ProjectTemplatesApi.md#instantiate_project) | **POST** /project_templates/{project_template_gid}/instantiateProject | Instantiate a project from a project template + +# **delete_project_template** + +Delete a project template + +A specific, existing project template can be deleted by making a DELETE request on the URL for that project template. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deleteprojecttemplate)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_templates_api_instance = asana.ProjectTemplatesApi(api_client) +project_template_gid = "1331" # str | Globally unique identifier for the project template. + + +try: + # Delete a project template + api_response = project_templates_api_instance.delete_project_template(project_template_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectTemplatesApi->delete_project_template: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_template_gid** | **str**| Globally unique identifier for the project template. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_template** + +Get a project template + +Returns the complete project template record for a single project template. + +([more information](https://developers.asana.com/reference/getprojecttemplate)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_templates_api_instance = asana.ProjectTemplatesApi(api_client) +project_template_gid = "1331" # str | Globally unique identifier for the project template. +opts = { + 'opt_fields': "color,description,html_description,name,owner,public,requested_dates,requested_dates.description,requested_dates.name,requested_roles,requested_roles.name,team,team.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a project template + api_response = project_templates_api_instance.get_project_template(project_template_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectTemplatesApi->get_project_template: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_template_gid** | **str**| Globally unique identifier for the project template. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_templates** + +Get multiple project templates + +Returns the compact project template records for all project templates in the given team or workspace. + +([more information](https://developers.asana.com/reference/getprojecttemplates)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_templates_api_instance = asana.ProjectTemplatesApi(api_client) +opts = { + 'workspace': "12345", # str | The workspace to filter results on. + 'team': "14916", # str | The team to filter projects on. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "color,description,html_description,name,offset,owner,path,public,requested_dates,requested_dates.description,requested_dates.name,requested_roles,requested_roles.name,team,team.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple project templates + api_response = project_templates_api_instance.get_project_templates(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectTemplatesApi->get_project_templates: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace** | **str**| The workspace to filter results on. | [optional] + **team** | **str**| The team to filter projects on. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project_templates_for_team** + +Get a team's project templates + +Returns the compact project template records for all project templates in the team. + +([more information](https://developers.asana.com/reference/getprojecttemplatesforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_templates_api_instance = asana.ProjectTemplatesApi(api_client) +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "color,description,html_description,name,offset,owner,path,public,requested_dates,requested_dates.description,requested_dates.name,requested_roles,requested_roles.name,team,team.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a team's project templates + api_response = project_templates_api_instance.get_project_templates_for_team(team_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectTemplatesApi->get_project_templates_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **team_gid** | **str**| Globally unique identifier for the team. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **instantiate_project** + +Instantiate a project from a project template + +Creates and returns a job that will asynchronously handle the project instantiation. To form this request, it is recommended to first make a request to [get a project template](/reference/getprojecttemplate). Then, from the response, copy the `gid` from the object in the `requested_dates` array. This `gid` should be used in `requested_dates` to instantiate a project. _Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the [is_organization](/reference/workspaces) parameter._ + +([more information](https://developers.asana.com/reference/instantiateproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +project_templates_api_instance = asana.ProjectTemplatesApi(api_client) +project_template_gid = "1331" # str | Globally unique identifier for the project template. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables. + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Instantiate a project from a project template + api_response = project_templates_api_instance.instantiate_project(project_template_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectTemplatesApi->instantiate_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_template_gid** | **str**| Globally unique identifier for the project template. | + **body** | **Dict**| Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProjectTemplatesApi.yaml b/docs/ProjectTemplatesApi.yaml new file mode 100644 index 00000000..984dfd0b --- /dev/null +++ b/docs/ProjectTemplatesApi.yaml @@ -0,0 +1,117 @@ +ProjectTemplatesApi: + delete_project_template: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_templates_api_instance = asana.ProjectTemplatesApi(api_client) + project_template_gid = "1331" # str | Globally unique identifier for the project template. + + + try: + # Delete a project template + api_response = project_templates_api_instance.delete_project_template(project_template_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectTemplatesApi->delete_project_template: %s\n" % e) + get_project_template: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_templates_api_instance = asana.ProjectTemplatesApi(api_client) + project_template_gid = "1331" # str | Globally unique identifier for the project template. + opts = { + 'opt_fields': "color,description,html_description,name,owner,public,requested_dates,requested_dates.description,requested_dates.name,requested_roles,requested_roles.name,team,team.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a project template + api_response = project_templates_api_instance.get_project_template(project_template_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectTemplatesApi->get_project_template: %s\n" % e) + get_project_templates: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_templates_api_instance = asana.ProjectTemplatesApi(api_client) + opts = { + 'workspace': "12345", # str | The workspace to filter results on. + 'team': "14916", # str | The team to filter projects on. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "color,description,html_description,name,offset,owner,path,public,requested_dates,requested_dates.description,requested_dates.name,requested_roles,requested_roles.name,team,team.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple project templates + api_response = project_templates_api_instance.get_project_templates(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectTemplatesApi->get_project_templates: %s\n" % e) + get_project_templates_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_templates_api_instance = asana.ProjectTemplatesApi(api_client) + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "color,description,html_description,name,offset,owner,path,public,requested_dates,requested_dates.description,requested_dates.name,requested_roles,requested_roles.name,team,team.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a team's project templates + api_response = project_templates_api_instance.get_project_templates_for_team(team_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectTemplatesApi->get_project_templates_for_team: %s\n" % e) + instantiate_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + project_templates_api_instance = asana.ProjectTemplatesApi(api_client) + project_template_gid = "1331" # str | Globally unique identifier for the project template. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables. + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Instantiate a project from a project template + api_response = project_templates_api_instance.instantiate_project(project_template_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectTemplatesApi->instantiate_project: %s\n" % e) diff --git a/docs/ProjectsApi.md b/docs/ProjectsApi.md new file mode 100644 index 00000000..80bc62dd --- /dev/null +++ b/docs/ProjectsApi.md @@ -0,0 +1,1036 @@ +# asana.ProjectsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_custom_field_setting_for_project**](ProjectsApi.md#add_custom_field_setting_for_project) | **POST** /projects/{project_gid}/addCustomFieldSetting | Add a custom field to a project +[**add_followers_for_project**](ProjectsApi.md#add_followers_for_project) | **POST** /projects/{project_gid}/addFollowers | Add followers to a project +[**add_members_for_project**](ProjectsApi.md#add_members_for_project) | **POST** /projects/{project_gid}/addMembers | Add users to a project +[**create_project**](ProjectsApi.md#create_project) | **POST** /projects | Create a project +[**create_project_for_team**](ProjectsApi.md#create_project_for_team) | **POST** /teams/{team_gid}/projects | Create a project in a team +[**create_project_for_workspace**](ProjectsApi.md#create_project_for_workspace) | **POST** /workspaces/{workspace_gid}/projects | Create a project in a workspace +[**delete_project**](ProjectsApi.md#delete_project) | **DELETE** /projects/{project_gid} | Delete a project +[**duplicate_project**](ProjectsApi.md#duplicate_project) | **POST** /projects/{project_gid}/duplicate | Duplicate a project +[**get_project**](ProjectsApi.md#get_project) | **GET** /projects/{project_gid} | Get a project +[**get_projects**](ProjectsApi.md#get_projects) | **GET** /projects | Get multiple projects +[**get_projects_for_task**](ProjectsApi.md#get_projects_for_task) | **GET** /tasks/{task_gid}/projects | Get projects a task is in +[**get_projects_for_team**](ProjectsApi.md#get_projects_for_team) | **GET** /teams/{team_gid}/projects | Get a team's projects +[**get_projects_for_workspace**](ProjectsApi.md#get_projects_for_workspace) | **GET** /workspaces/{workspace_gid}/projects | Get all projects in a workspace +[**get_task_counts_for_project**](ProjectsApi.md#get_task_counts_for_project) | **GET** /projects/{project_gid}/task_counts | Get task count of a project +[**project_save_as_template**](ProjectsApi.md#project_save_as_template) | **POST** /projects/{project_gid}/saveAsTemplate | Create a project template from a project +[**remove_custom_field_setting_for_project**](ProjectsApi.md#remove_custom_field_setting_for_project) | **POST** /projects/{project_gid}/removeCustomFieldSetting | Remove a custom field from a project +[**remove_followers_for_project**](ProjectsApi.md#remove_followers_for_project) | **POST** /projects/{project_gid}/removeFollowers | Remove followers from a project +[**remove_members_for_project**](ProjectsApi.md#remove_members_for_project) | **POST** /projects/{project_gid}/removeMembers | Remove users from a project +[**update_project**](ProjectsApi.md#update_project) | **PUT** /projects/{project_gid} | Update a project + +# **add_custom_field_setting_for_project** + +Add a custom field to a project + +Custom fields are associated with projects by way of custom field settings. This method creates a setting for the project. + +([more information](https://developers.asana.com/reference/addcustomfieldsettingforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting. +project_gid = "1331" # str | Globally unique identifier for the project. + + +try: + # Add a custom field to a project + api_response = projects_api_instance.add_custom_field_setting_for_project(body, project_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->add_custom_field_setting_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the custom field setting. | + **project_gid** | **str**| Globally unique identifier for the project. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_followers_for_project** + +Add followers to a project + +Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive \"tasks added\" notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation. Returns the updated project record. + +([more information](https://developers.asana.com/reference/addfollowersforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the followers being added. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add followers to a project + api_response = projects_api_instance.add_followers_for_project(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->add_followers_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the followers being added. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_members_for_project** + +Add users to a project + +Adds the specified list of users as members of the project. Note that a user being added as a member may also be added as a *follower* as a result of this operation. This is because the user's default notification settings (i.e., in the \"Notifcations\" tab of \"My Profile Settings\") will override this endpoint's default behavior of setting \"Tasks added\" notifications to `false`. Returns the updated project record. + +([more information](https://developers.asana.com/reference/addmembersforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being added. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add users to a project + api_response = projects_api_instance.add_members_for_project(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->add_members_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the members being added. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_project** + +Create a project + +Create a new project in a workspace or team. Every project is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the `workspace` parameter regardless of whether or not it is an organization. If the workspace for your project is an organization, you must also supply a `team` to share the project with. Returns the full record of the newly created project. + +([more information](https://developers.asana.com/reference/createproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project to create. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a project + api_response = projects_api_instance.create_project(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->create_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The project to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_project_for_team** + +Create a project in a team + +Creates a project shared with the given team. Returns the full record of the newly created project. + +([more information](https://developers.asana.com/reference/createprojectforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new project to create. +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a project in a team + api_response = projects_api_instance.create_project_for_team(body, team_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->create_project_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The new project to create. | + **team_gid** | **str**| Globally unique identifier for the team. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_project_for_workspace** + +Create a project in a workspace + +Creates a project in the workspace. If the workspace for your project is an organization, you must also supply a team to share the project with. Returns the full record of the newly created project. + +([more information](https://developers.asana.com/reference/createprojectforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new project to create. +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a project in a workspace + api_response = projects_api_instance.create_project_for_workspace(body, workspace_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->create_project_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The new project to create. | + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_project** + +Delete a project + +A specific, existing project can be deleted by making a DELETE request on the URL for that project. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deleteproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. + + +try: + # Delete a project + api_response = projects_api_instance.delete_project(project_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->delete_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **duplicate_project** + +Duplicate a project + +Creates and returns a job that will asynchronously handle the duplication. + +([more information](https://developers.asana.com/reference/duplicateproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the duplicate's name and the elements that will be duplicated. + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Duplicate a project + api_response = projects_api_instance.duplicate_project(project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->duplicate_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **body** | **Dict**| Describes the duplicate's name and the elements that will be duplicated. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_project** + +Get a project + +Returns the complete project record for a single project. + +([more information](https://developers.asana.com/reference/getproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a project + api_response = projects_api_instance.get_project(project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->get_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_projects** + +Get multiple projects + +Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned. *Note: This endpoint may timeout for large domains. Try filtering by team!* + +([more information](https://developers.asana.com/reference/getprojects)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'workspace': "1331", # str | The workspace or organization to filter projects on. + 'team': "14916", # str | The team to filter projects on. + 'archived': False, # bool | Only return projects whose `archived` field takes on the value of this parameter. + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple projects + api_response = projects_api_instance.get_projects(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectsApi->get_projects: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **workspace** | **str**| The workspace or organization to filter projects on. | [optional] + **team** | **str**| The team to filter projects on. | [optional] + **archived** | **bool**| Only return projects whose `archived` field takes on the value of this parameter. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_projects_for_task** + +Get projects a task is in + +Returns a compact representation of all of the projects the task is in. + +([more information](https://developers.asana.com/reference/getprojectsfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get projects a task is in + api_response = projects_api_instance.get_projects_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectsApi->get_projects_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_projects_for_team** + +Get a team's projects + +Returns the compact project records for all projects in the team. + +([more information](https://developers.asana.com/reference/getprojectsforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'archived': False, # bool | Only return projects whose `archived` field takes on the value of this parameter. + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a team's projects + api_response = projects_api_instance.get_projects_for_team(team_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectsApi->get_projects_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **team_gid** | **str**| Globally unique identifier for the team. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **archived** | **bool**| Only return projects whose `archived` field takes on the value of this parameter. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_projects_for_workspace** + +Get all projects in a workspace + +Returns the compact project records for all projects in the workspace. *Note: This endpoint may timeout for large domains. Prefer the `/teams/{team_gid}/projects` endpoint.* + +([more information](https://developers.asana.com/reference/getprojectsforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'archived': False, # bool | Only return projects whose `archived` field takes on the value of this parameter. + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get all projects in a workspace + api_response = projects_api_instance.get_projects_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling ProjectsApi->get_projects_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **archived** | **bool**| Only return projects whose `archived` field takes on the value of this parameter. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_task_counts_for_project** + +Get task count of a project + +Get an object that holds task count fields. **All fields are excluded by default**. You must [opt in](/docs/inputoutput-options) using `opt_fields` to get any information from this endpoint. This endpoint has an additional [rate limit](/docs/rate-limits) and each field counts especially high against our [cost limits](/docs/rate-limits#cost-limits). Milestones are just tasks, so they are included in the `num_tasks`, `num_incomplete_tasks`, and `num_completed_tasks` counts. + +([more information](https://developers.asana.com/reference/gettaskcountsforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "num_completed_milestones,num_completed_tasks,num_incomplete_milestones,num_incomplete_tasks,num_milestones,num_tasks" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get task count of a project + api_response = projects_api_instance.get_task_counts_for_project(project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->get_task_counts_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **project_save_as_template** + +Create a project template from a project + +Creates and returns a job that will asynchronously handle the project template creation. Note that while the resulting project template can be accessed with the API, it won't be visible in the Asana UI until Project Templates 2.0 is launched in the app. See more in [this forum post](https://forum.asana.com/t/a-new-api-for-project-templates/156432). + +([more information](https://developers.asana.com/reference/projectsaveastemplate)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a project template from a project + api_response = projects_api_instance.project_save_as_template(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->project_save_as_template: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_custom_field_setting_for_project** + +Remove a custom field from a project + +Removes a custom field setting from a project. + +([more information](https://developers.asana.com/reference/removecustomfieldsettingforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting being removed. +project_gid = "1331" # str | Globally unique identifier for the project. + + +try: + # Remove a custom field from a project + api_response = projects_api_instance.remove_custom_field_setting_for_project(body, project_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->remove_custom_field_setting_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the custom field setting being removed. | + **project_gid** | **str**| Globally unique identifier for the project. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_followers_for_project** + +Remove followers from a project + +Removes the specified list of users from following the project, this will not affect project membership status. Returns the updated project record. + +([more information](https://developers.asana.com/reference/removefollowersforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the followers being removed. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Remove followers from a project + api_response = projects_api_instance.remove_followers_for_project(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->remove_followers_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the followers being removed. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_members_for_project** + +Remove users from a project + +Removes the specified list of users from members of the project. Returns the updated project record. + +([more information](https://developers.asana.com/reference/removemembersforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being removed. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Remove users from a project + api_response = projects_api_instance.remove_members_for_project(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->remove_members_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the members being removed. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_project** + +Update a project + +A specific, existing project can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated project record. + +([more information](https://developers.asana.com/reference/updateproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +projects_api_instance = asana.ProjectsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the project. +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a project + api_response = projects_api_instance.update_project(body, project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling ProjectsApi->update_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the project. | + **project_gid** | **str**| Globally unique identifier for the project. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ProjectsApi.yaml b/docs/ProjectsApi.yaml new file mode 100644 index 00000000..a4a63dae --- /dev/null +++ b/docs/ProjectsApi.yaml @@ -0,0 +1,440 @@ +ProjectsApi: + add_custom_field_setting_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting. + project_gid = "1331" # str | Globally unique identifier for the project. + + + try: + # Add a custom field to a project + api_response = projects_api_instance.add_custom_field_setting_for_project(body, project_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->add_custom_field_setting_for_project: %s\n" % e) + add_followers_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the followers being added. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add followers to a project + api_response = projects_api_instance.add_followers_for_project(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->add_followers_for_project: %s\n" % e) + add_members_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being added. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add users to a project + api_response = projects_api_instance.add_members_for_project(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->add_members_for_project: %s\n" % e) + create_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project to create. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a project + api_response = projects_api_instance.create_project(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->create_project: %s\n" % e) + create_project_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new project to create. + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a project in a team + api_response = projects_api_instance.create_project_for_team(body, team_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->create_project_for_team: %s\n" % e) + create_project_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new project to create. + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a project in a workspace + api_response = projects_api_instance.create_project_for_workspace(body, workspace_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->create_project_for_workspace: %s\n" % e) + delete_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + + + try: + # Delete a project + api_response = projects_api_instance.delete_project(project_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->delete_project: %s\n" % e) + duplicate_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the duplicate's name and the elements that will be duplicated. + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Duplicate a project + api_response = projects_api_instance.duplicate_project(project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->duplicate_project: %s\n" % e) + get_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a project + api_response = projects_api_instance.get_project(project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->get_project: %s\n" % e) + get_projects: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'workspace': "1331", # str | The workspace or organization to filter projects on. + 'team': "14916", # str | The team to filter projects on. + 'archived': False, # bool | Only return projects whose `archived` field takes on the value of this parameter. + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple projects + api_response = projects_api_instance.get_projects(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectsApi->get_projects: %s\n" % e) + get_projects_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get projects a task is in + api_response = projects_api_instance.get_projects_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectsApi->get_projects_for_task: %s\n" % e) + get_projects_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'archived': False, # bool | Only return projects whose `archived` field takes on the value of this parameter. + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a team's projects + api_response = projects_api_instance.get_projects_for_team(team_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectsApi->get_projects_for_team: %s\n" % e) + get_projects_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'archived': False, # bool | Only return projects whose `archived` field takes on the value of this parameter. + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get all projects in a workspace + api_response = projects_api_instance.get_projects_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling ProjectsApi->get_projects_for_workspace: %s\n" % e) + get_task_counts_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "num_completed_milestones,num_completed_tasks,num_incomplete_milestones,num_incomplete_tasks,num_milestones,num_tasks" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get task count of a project + api_response = projects_api_instance.get_task_counts_for_project(project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->get_task_counts_for_project: %s\n" % e) + project_save_as_template: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a project template from a project + api_response = projects_api_instance.project_save_as_template(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->project_save_as_template: %s\n" % e) + remove_custom_field_setting_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the custom field setting being removed. + project_gid = "1331" # str | Globally unique identifier for the project. + + + try: + # Remove a custom field from a project + api_response = projects_api_instance.remove_custom_field_setting_for_project(body, project_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->remove_custom_field_setting_for_project: %s\n" % e) + remove_followers_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the followers being removed. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Remove followers from a project + api_response = projects_api_instance.remove_followers_for_project(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->remove_followers_for_project: %s\n" % e) + remove_members_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the members being removed. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Remove users from a project + api_response = projects_api_instance.remove_members_for_project(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->remove_members_for_project: %s\n" % e) + update_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + projects_api_instance = asana.ProjectsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the project. + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,project_brief,public,start_on,team,team.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a project + api_response = projects_api_instance.update_project(body, project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectsApi->update_project: %s\n" % e) diff --git a/docs/RulesApi.md b/docs/RulesApi.md new file mode 100644 index 00000000..f3d75cfd --- /dev/null +++ b/docs/RulesApi.md @@ -0,0 +1,58 @@ +# asana.RulesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**trigger_rule**](RulesApi.md#trigger_rule) | **POST** /rule_triggers/{rule_trigger_gid}/run | Trigger a rule + +# **trigger_rule** + +Trigger a rule + +Trigger a rule which uses an [\"incoming web request\"](/docs/incoming-web-requests) trigger. + +([more information](https://developers.asana.com/reference/triggerrule)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +rules_api_instance = asana.RulesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | A dictionary of variables accessible from within the rule. +rule_trigger_gid = "12345" # str | The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. + + +try: + # Trigger a rule + api_response = rules_api_instance.trigger_rule(body, rule_trigger_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling RulesApi->trigger_rule: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| A dictionary of variables accessible from within the rule. | + **rule_trigger_gid** | **str**| The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/RulesApi.yaml b/docs/RulesApi.yaml new file mode 100644 index 00000000..26c3e4ca --- /dev/null +++ b/docs/RulesApi.yaml @@ -0,0 +1,22 @@ +RulesApi: + trigger_rule: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + rules_api_instance = asana.RulesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | A dictionary of variables accessible from within the rule. + rule_trigger_gid = "12345" # str | The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. + + + try: + # Trigger a rule + api_response = rules_api_instance.trigger_rule(body, rule_trigger_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling RulesApi->trigger_rule: %s\n" % e) diff --git a/docs/SectionsApi.md b/docs/SectionsApi.md new file mode 100644 index 00000000..4efe71aa --- /dev/null +++ b/docs/SectionsApi.md @@ -0,0 +1,377 @@ +# asana.SectionsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_task_for_section**](SectionsApi.md#add_task_for_section) | **POST** /sections/{section_gid}/addTask | Add task to section +[**create_section_for_project**](SectionsApi.md#create_section_for_project) | **POST** /projects/{project_gid}/sections | Create a section in a project +[**delete_section**](SectionsApi.md#delete_section) | **DELETE** /sections/{section_gid} | Delete a section +[**get_section**](SectionsApi.md#get_section) | **GET** /sections/{section_gid} | Get a section +[**get_sections_for_project**](SectionsApi.md#get_sections_for_project) | **GET** /projects/{project_gid}/sections | Get sections in a project +[**insert_section_for_project**](SectionsApi.md#insert_section_for_project) | **POST** /projects/{project_gid}/sections/insert | Move or Insert sections +[**update_section**](SectionsApi.md#update_section) | **PUT** /sections/{section_gid} | Update a section + +# **add_task_for_section** + +Add task to section + +Add a task to a specific, existing section. This will remove the task from other sections of the project. The task will be inserted at the top of a section unless an insert_before or insert_after parameter is declared. This does not work for separators (tasks with the resource_subtype of section). + +([more information](https://developers.asana.com/reference/addtaskforsection)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +section_gid = "321654" # str | The globally unique identifier for the section. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The task and optionally the insert location. +} + +try: + # Add task to section + api_response = sections_api_instance.add_task_for_section(section_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling SectionsApi->add_task_for_section: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **section_gid** | **str**| The globally unique identifier for the section. | + **body** | **Dict**| The task and optionally the insert location. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_section_for_project** + +Create a section in a project + +Creates a new section in a project. Returns the full record of the newly created section. + +([more information](https://developers.asana.com/reference/createsectionforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The section to create. + 'opt_fields': "created_at,name,project,project.name,projects,projects.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a section in a project + api_response = sections_api_instance.create_section_for_project(project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling SectionsApi->create_section_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **body** | **Dict**| The section to create. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_section** + +Delete a section + +A specific, existing section can be deleted by making a DELETE request on the URL for that section. Note that sections must be empty to be deleted. The last remaining section cannot be deleted. Returns an empty data block. + +([more information](https://developers.asana.com/reference/deletesection)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +section_gid = "321654" # str | The globally unique identifier for the section. + + +try: + # Delete a section + api_response = sections_api_instance.delete_section(section_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling SectionsApi->delete_section: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **section_gid** | **str**| The globally unique identifier for the section. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_section** + +Get a section + +Returns the complete record for a single section. + +([more information](https://developers.asana.com/reference/getsection)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +section_gid = "321654" # str | The globally unique identifier for the section. +opts = { + 'opt_fields': "created_at,name,project,project.name,projects,projects.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a section + api_response = sections_api_instance.get_section(section_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling SectionsApi->get_section: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **section_gid** | **str**| The globally unique identifier for the section. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_sections_for_project** + +Get sections in a project + +Returns the compact records for all sections in the specified project. + +([more information](https://developers.asana.com/reference/getsectionsforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "created_at,name,offset,path,project,project.name,projects,projects.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get sections in a project + api_response = sections_api_instance.get_sections_for_project(project_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling SectionsApi->get_sections_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **insert_section_for_project** + +Move or Insert sections + +Move sections relative to each other. One of `before_section` or `after_section` is required. Sections cannot be moved between projects. Returns an empty data block. + +([more information](https://developers.asana.com/reference/insertsectionforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The section's move action. +} + +try: + # Move or Insert sections + api_response = sections_api_instance.insert_section_for_project(project_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling SectionsApi->insert_section_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **body** | **Dict**| The section's move action. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_section** + +Update a section + +A specific, existing section can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. (note that at this time, the only field that can be updated is the `name` field.) When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated section record. + +([more information](https://developers.asana.com/reference/updatesection)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +sections_api_instance = asana.SectionsApi(api_client) +section_gid = "321654" # str | The globally unique identifier for the section. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The section to create. + 'opt_fields': "created_at,name,project,project.name,projects,projects.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a section + api_response = sections_api_instance.update_section(section_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling SectionsApi->update_section: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **section_gid** | **str**| The globally unique identifier for the section. | + **body** | **Dict**| The section to create. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/SectionsApi.yaml b/docs/SectionsApi.yaml new file mode 100644 index 00000000..23adafff --- /dev/null +++ b/docs/SectionsApi.yaml @@ -0,0 +1,158 @@ +SectionsApi: + add_task_for_section: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + section_gid = "321654" # str | The globally unique identifier for the section. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The task and optionally the insert location. + } + + try: + # Add task to section + api_response = sections_api_instance.add_task_for_section(section_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling SectionsApi->add_task_for_section: %s\n" % e) + create_section_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The section to create. + 'opt_fields': "created_at,name,project,project.name,projects,projects.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a section in a project + api_response = sections_api_instance.create_section_for_project(project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling SectionsApi->create_section_for_project: %s\n" % e) + delete_section: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + section_gid = "321654" # str | The globally unique identifier for the section. + + + try: + # Delete a section + api_response = sections_api_instance.delete_section(section_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling SectionsApi->delete_section: %s\n" % e) + get_section: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + section_gid = "321654" # str | The globally unique identifier for the section. + opts = { + 'opt_fields': "created_at,name,project,project.name,projects,projects.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a section + api_response = sections_api_instance.get_section(section_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling SectionsApi->get_section: %s\n" % e) + get_sections_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "created_at,name,offset,path,project,project.name,projects,projects.name,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get sections in a project + api_response = sections_api_instance.get_sections_for_project(project_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling SectionsApi->get_sections_for_project: %s\n" % e) + insert_section_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The section's move action. + } + + try: + # Move or Insert sections + api_response = sections_api_instance.insert_section_for_project(project_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling SectionsApi->insert_section_for_project: %s\n" % e) + update_section: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + sections_api_instance = asana.SectionsApi(api_client) + section_gid = "321654" # str | The globally unique identifier for the section. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | The section to create. + 'opt_fields': "created_at,name,project,project.name,projects,projects.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a section + api_response = sections_api_instance.update_section(section_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling SectionsApi->update_section: %s\n" % e) diff --git a/docs/StatusUpdatesApi.md b/docs/StatusUpdatesApi.md new file mode 100644 index 00000000..ccaebe24 --- /dev/null +++ b/docs/StatusUpdatesApi.md @@ -0,0 +1,223 @@ +# asana.StatusUpdatesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_status_for_object**](StatusUpdatesApi.md#create_status_for_object) | **POST** /status_updates | Create a status update +[**delete_status**](StatusUpdatesApi.md#delete_status) | **DELETE** /status_updates/{status_update_gid} | Delete a status update +[**get_status**](StatusUpdatesApi.md#get_status) | **GET** /status_updates/{status_update_gid} | Get a status update +[**get_statuses_for_object**](StatusUpdatesApi.md#get_statuses_for_object) | **GET** /status_updates | Get status updates from an object + +# **create_status_for_object** + +Create a status update + +Creates a new status update on an object. Returns the full record of the newly created status update. + +([more information](https://developers.asana.com/reference/createstatusforobject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +status_updates_api_instance = asana.StatusUpdatesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The status update to create. +opts = { + 'limit': 50 # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9" # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "author,author.name,created_at,created_by,created_by.name,hearted,hearts,hearts.user,hearts.user.name,html_text,liked,likes,likes.user,likes.user.name,modified_at,num_hearts,num_likes,parent,parent.name,resource_subtype,status_type,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a status update + api_response = status_updates_api_instance.create_status_for_object(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling StatusUpdatesApi->create_status_for_object: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The status update to create. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_status** + +Delete a status update + +Deletes a specific, existing status update. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletestatus)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +status_updates_api_instance = asana.StatusUpdatesApi(api_client) +status_update_gid = "321654" # str | The status update to get. + + +try: + # Delete a status update + api_response = status_updates_api_instance.delete_status(status_update_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling StatusUpdatesApi->delete_status: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status_update_gid** | **str**| The status update to get. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_status** + +Get a status update + +Returns the complete record for a single status update. + +([more information](https://developers.asana.com/reference/getstatus)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +status_updates_api_instance = asana.StatusUpdatesApi(api_client) +status_update_gid = "321654" # str | The status update to get. +opts = { + 'opt_fields': "author,author.name,created_at,created_by,created_by.name,hearted,hearts,hearts.user,hearts.user.name,html_text,liked,likes,likes.user,likes.user.name,modified_at,num_hearts,num_likes,parent,parent.name,resource_subtype,status_type,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a status update + api_response = status_updates_api_instance.get_status(status_update_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling StatusUpdatesApi->get_status: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status_update_gid** | **str**| The status update to get. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_statuses_for_object** + +Get status updates from an object + +Returns the compact status update records for all updates on the object. + +([more information](https://developers.asana.com/reference/getstatusesforobject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +status_updates_api_instance = asana.StatusUpdatesApi(api_client) +parent = "159874" # str | Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'created_since': '2012-02-22T02:06:58.158Z', # datetime | Only return statuses that have been created since the given time. + 'opt_fields': "author,author.name,created_at,created_by,created_by.name,hearted,hearts,hearts.user,hearts.user.name,html_text,liked,likes,likes.user,likes.user.name,modified_at,num_hearts,num_likes,offset,parent,parent.name,path,resource_subtype,status_type,text,title,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get status updates from an object + api_response = status_updates_api_instance.get_statuses_for_object(parent, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling StatusUpdatesApi->get_statuses_for_object: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **parent** | **str**| Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **created_since** | **datetime**| Only return statuses that have been created since the given time. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/StatusUpdatesApi.yaml b/docs/StatusUpdatesApi.yaml new file mode 100644 index 00000000..73169a19 --- /dev/null +++ b/docs/StatusUpdatesApi.yaml @@ -0,0 +1,93 @@ +StatusUpdatesApi: + create_status_for_object: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + status_updates_api_instance = asana.StatusUpdatesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The status update to create. + opts = { + 'limit': 50 # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9" # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "author,author.name,created_at,created_by,created_by.name,hearted,hearts,hearts.user,hearts.user.name,html_text,liked,likes,likes.user,likes.user.name,modified_at,num_hearts,num_likes,parent,parent.name,resource_subtype,status_type,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a status update + api_response = status_updates_api_instance.create_status_for_object(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling StatusUpdatesApi->create_status_for_object: %s\n" % e) + delete_status: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + status_updates_api_instance = asana.StatusUpdatesApi(api_client) + status_update_gid = "321654" # str | The status update to get. + + + try: + # Delete a status update + api_response = status_updates_api_instance.delete_status(status_update_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling StatusUpdatesApi->delete_status: %s\n" % e) + get_status: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + status_updates_api_instance = asana.StatusUpdatesApi(api_client) + status_update_gid = "321654" # str | The status update to get. + opts = { + 'opt_fields': "author,author.name,created_at,created_by,created_by.name,hearted,hearts,hearts.user,hearts.user.name,html_text,liked,likes,likes.user,likes.user.name,modified_at,num_hearts,num_likes,parent,parent.name,resource_subtype,status_type,text,title" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a status update + api_response = status_updates_api_instance.get_status(status_update_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling StatusUpdatesApi->get_status: %s\n" % e) + get_statuses_for_object: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + status_updates_api_instance = asana.StatusUpdatesApi(api_client) + parent = "159874" # str | Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'created_since': '2012-02-22T02:06:58.158Z', # datetime | Only return statuses that have been created since the given time. + 'opt_fields': "author,author.name,created_at,created_by,created_by.name,hearted,hearts,hearts.user,hearts.user.name,html_text,liked,likes,likes.user,likes.user.name,modified_at,num_hearts,num_likes,offset,parent,parent.name,path,resource_subtype,status_type,text,title,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get status updates from an object + api_response = status_updates_api_instance.get_statuses_for_object(parent, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling StatusUpdatesApi->get_statuses_for_object: %s\n" % e) diff --git a/docs/StoriesApi.md b/docs/StoriesApi.md new file mode 100644 index 00000000..cc4d3c65 --- /dev/null +++ b/docs/StoriesApi.md @@ -0,0 +1,273 @@ +# asana.StoriesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_story_for_task**](StoriesApi.md#create_story_for_task) | **POST** /tasks/{task_gid}/stories | Create a story on a task +[**delete_story**](StoriesApi.md#delete_story) | **DELETE** /stories/{story_gid} | Delete a story +[**get_stories_for_task**](StoriesApi.md#get_stories_for_task) | **GET** /tasks/{task_gid}/stories | Get stories from a task +[**get_story**](StoriesApi.md#get_story) | **GET** /stories/{story_gid} | Get a story +[**update_story**](StoriesApi.md#update_story) | **PUT** /stories/{story_gid} | Update a story + +# **create_story_for_task** + +Create a story on a task + +Adds a story to a task. This endpoint currently only allows for comment stories to be created. The comment will be authored by the currently authenticated user, and timestamped when the server receives the request. Returns the full record for the new story added to the task. + +([more information](https://developers.asana.com/reference/createstoryfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +stories_api_instance = asana.StoriesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The story to create. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a story on a task + api_response = stories_api_instance.create_story_for_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling StoriesApi->create_story_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The story to create. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_story** + +Delete a story + +Deletes a story. A user can only delete stories they have created. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletestory)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +stories_api_instance = asana.StoriesApi(api_client) +story_gid = "35678" # str | Globally unique identifier for the story. + + +try: + # Delete a story + api_response = stories_api_instance.delete_story(story_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling StoriesApi->delete_story: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **story_gid** | **str**| Globally unique identifier for the story. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_stories_for_task** + +Get stories from a task + +Returns the compact records for all stories on the task. + +([more information](https://developers.asana.com/reference/getstoriesfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +stories_api_instance = asana.StoriesApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,offset,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,path,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get stories from a task + api_response = stories_api_instance.get_stories_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling StoriesApi->get_stories_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_story** + +Get a story + +Returns the full record for a single story. + +([more information](https://developers.asana.com/reference/getstory)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +stories_api_instance = asana.StoriesApi(api_client) +story_gid = "35678" # str | Globally unique identifier for the story. +opts = { + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a story + api_response = stories_api_instance.get_story(story_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling StoriesApi->get_story: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **story_gid** | **str**| Globally unique identifier for the story. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_story** + +Update a story + +Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. + +([more information](https://developers.asana.com/reference/updatestory)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +stories_api_instance = asana.StoriesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The comment story to update. +story_gid = "35678" # str | Globally unique identifier for the story. +opts = { + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a story + api_response = stories_api_instance.update_story(body, story_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling StoriesApi->update_story: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The comment story to update. | + **story_gid** | **str**| Globally unique identifier for the story. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/StoriesApi.yaml b/docs/StoriesApi.yaml new file mode 100644 index 00000000..e6e4ce4f --- /dev/null +++ b/docs/StoriesApi.yaml @@ -0,0 +1,114 @@ +StoriesApi: + create_story_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + stories_api_instance = asana.StoriesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The story to create. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a story on a task + api_response = stories_api_instance.create_story_for_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling StoriesApi->create_story_for_task: %s\n" % e) + delete_story: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + stories_api_instance = asana.StoriesApi(api_client) + story_gid = "35678" # str | Globally unique identifier for the story. + + + try: + # Delete a story + api_response = stories_api_instance.delete_story(story_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling StoriesApi->delete_story: %s\n" % e) + get_stories_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + stories_api_instance = asana.StoriesApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,offset,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,path,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get stories from a task + api_response = stories_api_instance.get_stories_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling StoriesApi->get_stories_for_task: %s\n" % e) + get_story: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + stories_api_instance = asana.StoriesApi(api_client) + story_gid = "35678" # str | Globally unique identifier for the story. + opts = { + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a story + api_response = stories_api_instance.get_story(story_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling StoriesApi->get_story: %s\n" % e) + update_story: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + stories_api_instance = asana.StoriesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The comment story to update. + story_gid = "35678" # str | Globally unique identifier for the story. + opts = { + 'opt_fields': "assignee,assignee.name,created_at,created_by,created_by.name,custom_field,custom_field.date_value,custom_field.date_value.date,custom_field.date_value.date_time,custom_field.display_value,custom_field.enabled,custom_field.enum_options,custom_field.enum_options.color,custom_field.enum_options.enabled,custom_field.enum_options.name,custom_field.enum_value,custom_field.enum_value.color,custom_field.enum_value.enabled,custom_field.enum_value.name,custom_field.is_formula_field,custom_field.multi_enum_values,custom_field.multi_enum_values.color,custom_field.multi_enum_values.enabled,custom_field.multi_enum_values.name,custom_field.name,custom_field.number_value,custom_field.resource_subtype,custom_field.text_value,custom_field.type,dependency,dependency.created_by,dependency.name,dependency.resource_subtype,duplicate_of,duplicate_of.created_by,duplicate_of.name,duplicate_of.resource_subtype,duplicated_from,duplicated_from.created_by,duplicated_from.name,duplicated_from.resource_subtype,follower,follower.name,hearted,hearts,hearts.user,hearts.user.name,html_text,is_editable,is_edited,is_pinned,liked,likes,likes.user,likes.user.name,new_approval_status,new_date_value,new_dates,new_dates.due_at,new_dates.due_on,new_dates.start_on,new_enum_value,new_enum_value.color,new_enum_value.enabled,new_enum_value.name,new_multi_enum_values,new_multi_enum_values.color,new_multi_enum_values.enabled,new_multi_enum_values.name,new_name,new_number_value,new_people_value,new_people_value.name,new_resource_subtype,new_section,new_section.name,new_text_value,num_hearts,num_likes,old_approval_status,old_date_value,old_dates,old_dates.due_at,old_dates.due_on,old_dates.start_on,old_enum_value,old_enum_value.color,old_enum_value.enabled,old_enum_value.name,old_multi_enum_values,old_multi_enum_values.color,old_multi_enum_values.enabled,old_multi_enum_values.name,old_name,old_number_value,old_people_value,old_people_value.name,old_resource_subtype,old_section,old_section.name,old_text_value,previews,previews.fallback,previews.footer,previews.header,previews.header_link,previews.html_text,previews.text,previews.title,previews.title_link,project,project.name,resource_subtype,source,sticker_name,story,story.created_at,story.created_by,story.created_by.name,story.resource_subtype,story.text,tag,tag.name,target,target.created_by,target.name,target.resource_subtype,task,task.created_by,task.name,task.resource_subtype,text,type" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a story + api_response = stories_api_instance.update_story(body, story_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling StoriesApi->update_story: %s\n" % e) diff --git a/docs/TagsApi.md b/docs/TagsApi.md new file mode 100644 index 00000000..f95908be --- /dev/null +++ b/docs/TagsApi.md @@ -0,0 +1,437 @@ +# asana.TagsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_tag**](TagsApi.md#create_tag) | **POST** /tags | Create a tag +[**create_tag_for_workspace**](TagsApi.md#create_tag_for_workspace) | **POST** /workspaces/{workspace_gid}/tags | Create a tag in a workspace +[**delete_tag**](TagsApi.md#delete_tag) | **DELETE** /tags/{tag_gid} | Delete a tag +[**get_tag**](TagsApi.md#get_tag) | **GET** /tags/{tag_gid} | Get a tag +[**get_tags**](TagsApi.md#get_tags) | **GET** /tags | Get multiple tags +[**get_tags_for_task**](TagsApi.md#get_tags_for_task) | **GET** /tasks/{task_gid}/tags | Get a task's tags +[**get_tags_for_workspace**](TagsApi.md#get_tags_for_workspace) | **GET** /workspaces/{workspace_gid}/tags | Get tags in a workspace +[**update_tag**](TagsApi.md#update_tag) | **PUT** /tags/{tag_gid} | Update a tag + +# **create_tag** + +Create a tag + +Creates a new tag in a workspace or organization. Every tag is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the workspace parameter regardless of whether or not it is an organization. Returns the full record of the newly created tag. + +([more information](https://developers.asana.com/reference/createtag)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to create. +opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a tag + api_response = tags_api_instance.create_tag(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TagsApi->create_tag: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The tag to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_tag_for_workspace** + +Create a tag in a workspace + +Creates a new tag in a workspace or organization. Every tag is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the workspace parameter regardless of whether or not it is an organization. Returns the full record of the newly created tag. + +([more information](https://developers.asana.com/reference/createtagforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to create. +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a tag in a workspace + api_response = tags_api_instance.create_tag_for_workspace(body, workspace_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TagsApi->create_tag_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The tag to create. | + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_tag** + +Delete a tag + +A specific, existing tag can be deleted by making a DELETE request on the URL for that tag. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletetag)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +tag_gid = "11235" # str | Globally unique identifier for the tag. + + +try: + # Delete a tag + api_response = tags_api_instance.delete_tag(tag_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TagsApi->delete_tag: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag_gid** | **str**| Globally unique identifier for the tag. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tag** + +Get a tag + +Returns the complete tag record for a single tag. + +([more information](https://developers.asana.com/reference/gettag)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +tag_gid = "11235" # str | Globally unique identifier for the tag. +opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a tag + api_response = tags_api_instance.get_tag(tag_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TagsApi->get_tag: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag_gid** | **str**| Globally unique identifier for the tag. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tags** + +Get multiple tags + +Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned. + +([more information](https://developers.asana.com/reference/gettags)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'workspace': "1331", # str | The workspace to filter tags on. + 'opt_fields': "color,created_at,followers,followers.name,name,notes,offset,path,permalink_url,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple tags + api_response = tags_api_instance.get_tags(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TagsApi->get_tags: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **workspace** | **str**| The workspace to filter tags on. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tags_for_task** + +Get a task's tags + +Get a compact representation of all of the tags the task has. + +([more information](https://developers.asana.com/reference/gettagsfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "color,created_at,followers,followers.name,name,notes,offset,path,permalink_url,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a task's tags + api_response = tags_api_instance.get_tags_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TagsApi->get_tags_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tags_for_workspace** + +Get tags in a workspace + +Returns the compact tag records for some filtered set of tags. Use one or more of the parameters provided to filter the tags returned. + +([more information](https://developers.asana.com/reference/gettagsforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "color,created_at,followers,followers.name,name,notes,offset,path,permalink_url,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get tags in a workspace + api_response = tags_api_instance.get_tags_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TagsApi->get_tags_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_tag** + +Update a tag + +Updates the properties of a tag. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the tag. Returns the complete updated tag record. + +([more information](https://developers.asana.com/reference/updatetag)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tags_api_instance = asana.TagsApi(api_client) +tag_gid = "11235" # str | Globally unique identifier for the tag. +opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a tag + api_response = tags_api_instance.update_tag(tag_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TagsApi->update_tag: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag_gid** | **str**| Globally unique identifier for the tag. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TagsApi.yaml b/docs/TagsApi.yaml new file mode 100644 index 00000000..71049318 --- /dev/null +++ b/docs/TagsApi.yaml @@ -0,0 +1,185 @@ +TagsApi: + create_tag: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to create. + opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a tag + api_response = tags_api_instance.create_tag(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TagsApi->create_tag: %s\n" % e) + create_tag_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to create. + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a tag in a workspace + api_response = tags_api_instance.create_tag_for_workspace(body, workspace_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TagsApi->create_tag_for_workspace: %s\n" % e) + delete_tag: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + tag_gid = "11235" # str | Globally unique identifier for the tag. + + + try: + # Delete a tag + api_response = tags_api_instance.delete_tag(tag_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TagsApi->delete_tag: %s\n" % e) + get_tag: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + tag_gid = "11235" # str | Globally unique identifier for the tag. + opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a tag + api_response = tags_api_instance.get_tag(tag_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TagsApi->get_tag: %s\n" % e) + get_tags: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'workspace': "1331", # str | The workspace to filter tags on. + 'opt_fields': "color,created_at,followers,followers.name,name,notes,offset,path,permalink_url,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple tags + api_response = tags_api_instance.get_tags(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TagsApi->get_tags: %s\n" % e) + get_tags_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "color,created_at,followers,followers.name,name,notes,offset,path,permalink_url,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a task's tags + api_response = tags_api_instance.get_tags_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TagsApi->get_tags_for_task: %s\n" % e) + get_tags_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "color,created_at,followers,followers.name,name,notes,offset,path,permalink_url,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get tags in a workspace + api_response = tags_api_instance.get_tags_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TagsApi->get_tags_for_workspace: %s\n" % e) + update_tag: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tags_api_instance = asana.TagsApi(api_client) + tag_gid = "11235" # str | Globally unique identifier for the tag. + opts = { + 'opt_fields': "color,created_at,followers,followers.name,name,notes,permalink_url,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a tag + api_response = tags_api_instance.update_tag(tag_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TagsApi->update_tag: %s\n" % e) diff --git a/docs/TaskTemplatesApi.md b/docs/TaskTemplatesApi.md new file mode 100644 index 00000000..744b752e --- /dev/null +++ b/docs/TaskTemplatesApi.md @@ -0,0 +1,170 @@ +# asana.TaskTemplatesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_task_template**](TaskTemplatesApi.md#get_task_template) | **GET** /task_templates/{task_template_gid} | Get a task template +[**get_task_templates**](TaskTemplatesApi.md#get_task_templates) | **GET** /task_templates | Get multiple task templates +[**instantiate_task**](TaskTemplatesApi.md#instantiate_task) | **POST** /task_templates/{task_template_gid}/instantiateTask | Instantiate a task from a task template + +# **get_task_template** + +Get a task template + +Returns the complete task template record for a single task template. + +([more information](https://developers.asana.com/reference/gettasktemplate)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +task_templates_api_instance = asana.TaskTemplatesApi(api_client) +task_template_gid = "1331" # str | Globally unique identifier for the task template. +opts = { + 'opt_fields': "created_at,created_by,name,project,template" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a task template + api_response = task_templates_api_instance.get_task_template(task_template_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TaskTemplatesApi->get_task_template: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_template_gid** | **str**| Globally unique identifier for the task template. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_task_templates** + +Get multiple task templates + +Returns the compact task template records for some filtered set of task templates. You must specify a `project` + +([more information](https://developers.asana.com/reference/gettasktemplates)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +task_templates_api_instance = asana.TaskTemplatesApi(api_client) +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'project': "321654", # str | The project to filter task templates on. + 'opt_fields': "created_at,created_by,name,project,template" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple task templates + api_response = task_templates_api_instance.get_task_templates(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TaskTemplatesApi->get_task_templates: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **project** | **str**| The project to filter task templates on. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **instantiate_task** + +Instantiate a task from a task template + +Creates and returns a job that will asynchronously handle the task instantiation. + +([more information](https://developers.asana.com/reference/instantiatetask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +task_templates_api_instance = asana.TaskTemplatesApi(api_client) +task_template_gid = "1331" # str | Globally unique identifier for the task template. +opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the inputs used for instantiating a task - the task's name. + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Instantiate a task from a task template + api_response = task_templates_api_instance.instantiate_task(task_template_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TaskTemplatesApi->instantiate_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_template_gid** | **str**| Globally unique identifier for the task template. | + **body** | **Dict**| Describes the inputs used for instantiating a task - the task's name. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TaskTemplatesApi.yaml b/docs/TaskTemplatesApi.yaml new file mode 100644 index 00000000..399439d1 --- /dev/null +++ b/docs/TaskTemplatesApi.yaml @@ -0,0 +1,71 @@ +TaskTemplatesApi: + get_task_template: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + task_templates_api_instance = asana.TaskTemplatesApi(api_client) + task_template_gid = "1331" # str | Globally unique identifier for the task template. + opts = { + 'opt_fields': "created_at,created_by,name,project,template" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a task template + api_response = task_templates_api_instance.get_task_template(task_template_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TaskTemplatesApi->get_task_template: %s\n" % e) + get_task_templates: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + task_templates_api_instance = asana.TaskTemplatesApi(api_client) + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'project': "321654", # str | The project to filter task templates on. + 'opt_fields': "created_at,created_by,name,project,template" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple task templates + api_response = task_templates_api_instance.get_task_templates(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TaskTemplatesApi->get_task_templates: %s\n" % e) + instantiate_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + task_templates_api_instance = asana.TaskTemplatesApi(api_client) + task_template_gid = "1331" # str | Globally unique identifier for the task template. + opts = { + 'body': {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the inputs used for instantiating a task - the task's name. + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Instantiate a task from a task template + api_response = task_templates_api_instance.instantiate_task(task_template_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TaskTemplatesApi->instantiate_task: %s\n" % e) diff --git a/docs/TasksApi.md b/docs/TasksApi.md new file mode 100644 index 00000000..d2cfcfdc --- /dev/null +++ b/docs/TasksApi.md @@ -0,0 +1,1528 @@ +# asana.TasksApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_dependencies_for_task**](TasksApi.md#add_dependencies_for_task) | **POST** /tasks/{task_gid}/addDependencies | Set dependencies for a task +[**add_dependents_for_task**](TasksApi.md#add_dependents_for_task) | **POST** /tasks/{task_gid}/addDependents | Set dependents for a task +[**add_followers_for_task**](TasksApi.md#add_followers_for_task) | **POST** /tasks/{task_gid}/addFollowers | Add followers to a task +[**add_project_for_task**](TasksApi.md#add_project_for_task) | **POST** /tasks/{task_gid}/addProject | Add a project to a task +[**add_tag_for_task**](TasksApi.md#add_tag_for_task) | **POST** /tasks/{task_gid}/addTag | Add a tag to a task +[**create_subtask_for_task**](TasksApi.md#create_subtask_for_task) | **POST** /tasks/{task_gid}/subtasks | Create a subtask +[**create_task**](TasksApi.md#create_task) | **POST** /tasks | Create a task +[**delete_task**](TasksApi.md#delete_task) | **DELETE** /tasks/{task_gid} | Delete a task +[**duplicate_task**](TasksApi.md#duplicate_task) | **POST** /tasks/{task_gid}/duplicate | Duplicate a task +[**get_dependencies_for_task**](TasksApi.md#get_dependencies_for_task) | **GET** /tasks/{task_gid}/dependencies | Get dependencies from a task +[**get_dependents_for_task**](TasksApi.md#get_dependents_for_task) | **GET** /tasks/{task_gid}/dependents | Get dependents from a task +[**get_subtasks_for_task**](TasksApi.md#get_subtasks_for_task) | **GET** /tasks/{task_gid}/subtasks | Get subtasks from a task +[**get_task**](TasksApi.md#get_task) | **GET** /tasks/{task_gid} | Get a task +[**get_tasks**](TasksApi.md#get_tasks) | **GET** /tasks | Get multiple tasks +[**get_tasks_for_project**](TasksApi.md#get_tasks_for_project) | **GET** /projects/{project_gid}/tasks | Get tasks from a project +[**get_tasks_for_section**](TasksApi.md#get_tasks_for_section) | **GET** /sections/{section_gid}/tasks | Get tasks from a section +[**get_tasks_for_tag**](TasksApi.md#get_tasks_for_tag) | **GET** /tags/{tag_gid}/tasks | Get tasks from a tag +[**get_tasks_for_user_task_list**](TasksApi.md#get_tasks_for_user_task_list) | **GET** /user_task_lists/{user_task_list_gid}/tasks | Get tasks from a user task list +[**remove_dependencies_for_task**](TasksApi.md#remove_dependencies_for_task) | **POST** /tasks/{task_gid}/removeDependencies | Unlink dependencies from a task +[**remove_dependents_for_task**](TasksApi.md#remove_dependents_for_task) | **POST** /tasks/{task_gid}/removeDependents | Unlink dependents from a task +[**remove_follower_for_task**](TasksApi.md#remove_follower_for_task) | **POST** /tasks/{task_gid}/removeFollowers | Remove followers from a task +[**remove_project_for_task**](TasksApi.md#remove_project_for_task) | **POST** /tasks/{task_gid}/removeProject | Remove a project from a task +[**remove_tag_for_task**](TasksApi.md#remove_tag_for_task) | **POST** /tasks/{task_gid}/removeTag | Remove a tag from a task +[**search_tasks_for_workspace**](TasksApi.md#search_tasks_for_workspace) | **GET** /workspaces/{workspace_gid}/tasks/search | Search tasks in a workspace +[**set_parent_for_task**](TasksApi.md#set_parent_for_task) | **POST** /tasks/{task_gid}/setParent | Set the parent of a task +[**update_task**](TasksApi.md#update_task) | **PUT** /tasks/{task_gid} | Update a task + +# **add_dependencies_for_task** + +Set dependencies for a task + +Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 30 dependents and dependencies combined*. + +([more information](https://developers.asana.com/reference/adddependenciesfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to set as dependencies. +task_gid = "321654" # str | The task to operate on. + + +try: + # Set dependencies for a task + api_response = tasks_api_instance.add_dependencies_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->add_dependencies_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The list of tasks to set as dependencies. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_dependents_for_task** + +Set dependents for a task + +Marks a set of tasks as dependents of this task, if they are not already dependents. *A task can have at most 30 dependents and dependencies combined*. + +([more information](https://developers.asana.com/reference/adddependentsfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to add as dependents. +task_gid = "321654" # str | The task to operate on. + + +try: + # Set dependents for a task + api_response = tasks_api_instance.add_dependents_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->add_dependents_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The list of tasks to add as dependents. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_followers_for_task** + +Add followers to a task + +Adds followers to a task. Returns an empty data block. Each task can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated task record, described above. + +([more information](https://developers.asana.com/reference/addfollowersfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to add to the task. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add followers to a task + api_response = tasks_api_instance.add_followers_for_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->add_followers_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The followers to add to the task. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_project_for_task** + +Add a project to a task + +Adds the task to the specified project, in the optional location specified. If no location arguments are given, the task will be added to the end of the project. `addProject` can also be used to reorder a task within a project or section that already contains it. At most one of `insert_before`, `insert_after`, or `section` should be specified. Inserting into a section in an non-order-dependent way can be done by specifying section, otherwise, to insert within a section in a particular place, specify `insert_before` or `insert_after` and a task within the section to anchor the position of this task. Returns an empty data block. + +([more information](https://developers.asana.com/reference/addprojectfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project to add the task to. +task_gid = "321654" # str | The task to operate on. + + +try: + # Add a project to a task + api_response = tasks_api_instance.add_project_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->add_project_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The project to add the task to. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **add_tag_for_task** + +Add a tag to a task + +Adds a tag to a task. Returns an empty data block. + +([more information](https://developers.asana.com/reference/addtagfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to add to the task. +task_gid = "321654" # str | The task to operate on. + + +try: + # Add a tag to a task + api_response = tasks_api_instance.add_tag_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->add_tag_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The tag to add to the task. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_subtask_for_task** + +Create a subtask + +Creates a new subtask and adds it to the parent task. Returns the full record for the newly created subtask. + +([more information](https://developers.asana.com/reference/createsubtaskfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new subtask to create. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a subtask + api_response = tasks_api_instance.create_subtask_for_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->create_subtask_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The new subtask to create. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_task** + +Create a task + +Creating a new task is as easy as POSTing to the `/tasks` endpoint with a data block containing the fields you’d like to set on the task. Any unspecified fields will take on default values. Every task is required to be created in a specific workspace, and this workspace cannot be changed once set. The workspace need not be set explicitly if you specify `projects` or a `parent` task instead. + +([more information](https://developers.asana.com/reference/createtask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The task to create. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a task + api_response = tasks_api_instance.create_task(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->create_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The task to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_task** + +Delete a task + +A specific, existing task can be deleted by making a DELETE request on the URL for that task. Deleted tasks go into the “trash” of the user making the delete request. Tasks can be recovered from the trash within a period of 30 days; afterward they are completely removed from the system. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletetask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +task_gid = "321654" # str | The task to operate on. + + +try: + # Delete a task + api_response = tasks_api_instance.delete_task(task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->delete_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **duplicate_task** + +Duplicate a task + +Creates and returns a job that will asynchronously handle the duplication. + +([more information](https://developers.asana.com/reference/duplicatetask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the duplicate's name and the fields that will be duplicated. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Duplicate a task + api_response = tasks_api_instance.duplicate_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->duplicate_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Describes the duplicate's name and the fields that will be duplicated. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_dependencies_for_task** + +Get dependencies from a task + +Returns the compact representations of all of the dependencies of a task. + +([more information](https://developers.asana.com/reference/getdependenciesfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get dependencies from a task + api_response = tasks_api_instance.get_dependencies_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_dependencies_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_dependents_for_task** + +Get dependents from a task + +Returns the compact representations of all of the dependents of a task. + +([more information](https://developers.asana.com/reference/getdependentsfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get dependents from a task + api_response = tasks_api_instance.get_dependents_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_dependents_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_subtasks_for_task** + +Get subtasks from a task + +Returns a compact representation of all of the subtasks of a task. + +([more information](https://developers.asana.com/reference/getsubtasksfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get subtasks from a task + api_response = tasks_api_instance.get_subtasks_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_subtasks_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_task** + +Get a task + +Returns the complete task record for a single task. + +([more information](https://developers.asana.com/reference/gettask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a task + api_response = tasks_api_instance.get_task(task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->get_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tasks** + +Get multiple tasks + +Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`. For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/reference/searchtasksforworkspace). + +([more information](https://developers.asana.com/reference/gettasks)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'assignee': "14641", # str | The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.* + 'project': "321654", # str | The project to filter tasks on. + 'section': "321654", # str | The section to filter tasks on. + 'workspace': "321654", # str | The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.* + 'completed_since': '2012-02-22T02:06:58.158Z', # datetime | Only return tasks that are either incomplete or that have been completed since this time. + 'modified_since': '2012-02-22T02:06:58.158Z', # datetime | Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.* + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple tasks + api_response = tasks_api_instance.get_tasks(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **assignee** | **str**| The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.* | [optional] + **project** | **str**| The project to filter tasks on. | [optional] + **section** | **str**| The section to filter tasks on. | [optional] + **workspace** | **str**| The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.* | [optional] + **completed_since** | **datetime**| Only return tasks that are either incomplete or that have been completed since this time. | [optional] + **modified_since** | **datetime**| Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.* | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tasks_for_project** + +Get tasks from a project + +Returns the compact task records for all tasks within the given project, ordered by their priority within the project. Tasks can exist in more than one project at a time. + +([more information](https://developers.asana.com/reference/gettasksforproject)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +project_gid = "1331" # str | Globally unique identifier for the project. +opts = { + 'completed_since': "2012-02-22T02:06:58.158Z", # str | Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get tasks from a project + api_response = tasks_api_instance.get_tasks_for_project(project_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_gid** | **str**| Globally unique identifier for the project. | + **completed_since** | **str**| Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tasks_for_section** + +Get tasks from a section + +*Board view only*: Returns the compact section records for all tasks within the given section. + +([more information](https://developers.asana.com/reference/gettasksforsection)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +section_gid = "321654" # str | The globally unique identifier for the section. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'completed_since': "2012-02-22T02:06:58.158Z", # str | Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get tasks from a section + api_response = tasks_api_instance.get_tasks_for_section(section_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_section: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **section_gid** | **str**| The globally unique identifier for the section. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **completed_since** | **str**| Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tasks_for_tag** + +Get tasks from a tag + +Returns the compact task records for all tasks with the given tag. Tasks can have more than one tag at a time. + +([more information](https://developers.asana.com/reference/gettasksfortag)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +tag_gid = "11235" # str | Globally unique identifier for the tag. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get tasks from a tag + api_response = tasks_api_instance.get_tasks_for_tag(tag_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_tag: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag_gid** | **str**| Globally unique identifier for the tag. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_tasks_for_user_task_list** + +Get tasks from a user task list + +Returns the compact list of tasks in a user’s My Tasks list. *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)* + +([more information](https://developers.asana.com/reference/gettasksforusertasklist)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +user_task_list_gid = "12345" # str | Globally unique identifier for the user task list. +opts = { + 'completed_since': "2012-02-22T02:06:58.158Z", # str | Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get tasks from a user task list + api_response = tasks_api_instance.get_tasks_for_user_task_list(user_task_list_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_user_task_list: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_task_list_gid** | **str**| Globally unique identifier for the user task list. | + **completed_since** | **str**| Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_dependencies_for_task** + +Unlink dependencies from a task + +Unlinks a set of dependencies from this task. + +([more information](https://developers.asana.com/reference/removedependenciesfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to unlink as dependencies. +task_gid = "321654" # str | The task to operate on. + + +try: + # Unlink dependencies from a task + api_response = tasks_api_instance.remove_dependencies_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->remove_dependencies_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The list of tasks to unlink as dependencies. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_dependents_for_task** + +Unlink dependents from a task + +Unlinks a set of dependents from this task. + +([more information](https://developers.asana.com/reference/removedependentsfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to remove as dependents. +task_gid = "321654" # str | The task to operate on. + + +try: + # Unlink dependents from a task + api_response = tasks_api_instance.remove_dependents_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->remove_dependents_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The list of tasks to remove as dependents. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_follower_for_task** + +Remove followers from a task + +Removes each of the specified followers from the task if they are following. Returns the complete, updated record for the affected task. + +([more information](https://developers.asana.com/reference/removefollowerfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to remove from the task. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Remove followers from a task + api_response = tasks_api_instance.remove_follower_for_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->remove_follower_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The followers to remove from the task. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_project_for_task** + +Remove a project from a task + +Removes the task from the specified project. The task will still exist in the system, but it will not be in the project anymore. Returns an empty data block. + +([more information](https://developers.asana.com/reference/removeprojectfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project to remove the task from. +task_gid = "321654" # str | The task to operate on. + + +try: + # Remove a project from a task + api_response = tasks_api_instance.remove_project_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->remove_project_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The project to remove the task from. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_tag_for_task** + +Remove a tag from a task + +Removes a tag from a task. Returns an empty data block. + +([more information](https://developers.asana.com/reference/removetagfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to remove from the task. +task_gid = "321654" # str | The task to operate on. + + +try: + # Remove a tag from a task + api_response = tasks_api_instance.remove_tag_for_task(body, task_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->remove_tag_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The tag to remove from the task. | + **task_gid** | **str**| The task to operate on. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **search_tasks_for_workspace** + +Search tasks in a workspace + +To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need. #### Premium access Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true: - The workspace in which the search is being performed is a premium workspace - The user is a member of a premium team inside the workspace Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a `402 Payment Required` error. #### Pagination Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional [pagination](https://developers.asana.com/docs/#pagination) available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the `limit` query parameter. #### Eventual consistency Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product. #### Rate limits You may receive a `429 Too Many Requests` response if you hit any of our [rate limits](https://developers.asana.com/docs/#rate-limits). #### Custom field parameters | Parameter name | Custom field type | Accepted type | |---|---|---| | custom_fields.{gid}.is_set | All | Boolean | | custom_fields.{gid}.value | Text | String | | custom_fields.{gid}.value | Number | Number | | custom_fields.{gid}.value | Enum | Enum option ID | | custom_fields.{gid}.starts_with | Text only | String | | custom_fields.{gid}.ends_with | Text only | String | | custom_fields.{gid}.contains | Text only | String | | custom_fields.{gid}.less_than | Number only | Number | | custom_fields.{gid}.greater_than | Number only | Number | For example, if the gid of the custom field is 12345, these query parameter to find tasks where it is set would be `custom_fields.12345.is_set=true`. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: `custom_fields.12345.value=67890`. **Not Supported**: searching for multiple exact matches of a custom field, searching for multi-enum custom field *Note: If you specify `projects.any` and `sections.any`, you will receive tasks for the project **and** tasks for the section. If you're looking for only tasks in a section, omit the `projects.any` from the request.* + +([more information](https://developers.asana.com/reference/searchtasksforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'text': "Bug", # str | Performs full-text search on both task name and description + 'resource_subtype': "milestone", # str | Filters results by the task's resource_subtype + 'assignee.any': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'assignee.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'portfolios.any': "12345,23456,34567", # str | Comma-separated list of portfolio IDs + 'projects.any': "12345,23456,34567", # str | Comma-separated list of project IDs + 'projects.not': "12345,23456,34567", # str | Comma-separated list of project IDs + 'projects.all': "12345,23456,34567", # str | Comma-separated list of project IDs + 'sections.any': "12345,23456,34567", # str | Comma-separated list of section or column IDs + 'sections.not': "12345,23456,34567", # str | Comma-separated list of section or column IDs + 'sections.all': "12345,23456,34567", # str | Comma-separated list of section or column IDs + 'tags.any': "12345,23456,34567", # str | Comma-separated list of tag IDs + 'tags.not': "12345,23456,34567", # str | Comma-separated list of tag IDs + 'tags.all': "12345,23456,34567", # str | Comma-separated list of tag IDs + 'teams.any': "12345,23456,34567", # str | Comma-separated list of team IDs + 'followers.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'created_by.any': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'created_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'assigned_by.any': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'assigned_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'liked_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'commented_on_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'due_on.before': '2019-09-15', # date | ISO 8601 date string + 'due_on.after': '2019-09-15', # date | ISO 8601 date string + 'due_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'due_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'due_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'start_on.before': '2019-09-15', # date | ISO 8601 date string + 'start_on.after': '2019-09-15', # date | ISO 8601 date string + 'start_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'created_on.before': '2019-09-15', # date | ISO 8601 date string + 'created_on.after': '2019-09-15', # date | ISO 8601 date string + 'created_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'created_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'created_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'completed_on.before': '2019-09-15', # date | ISO 8601 date string + 'completed_on.after': '2019-09-15', # date | ISO 8601 date string + 'completed_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'completed_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'completed_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'modified_on.before': '2019-09-15', # date | ISO 8601 date string + 'modified_on.after': '2019-09-15', # date | ISO 8601 date string + 'modified_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'modified_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'modified_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'is_blocking': False, # bool | Filter to incomplete tasks with dependents + 'is_blocked': False, # bool | Filter to tasks with incomplete dependencies + 'has_attachment': False, # bool | Filter to tasks with attachments + 'completed': False, # bool | Filter to completed tasks + 'is_subtask': False, # bool | Filter to subtasks + 'sort_by': "modified_at", # str | One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at` + 'sort_ascending': True, # bool | Default `false` + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} +opts['custom_fields.123.is_set'] = True # bool | Filiter to tasks with custom field set or unset. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.value'] = '456' # str or bool or Enum option ID | Filter to tasks with custom field that matches the provided value. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.starts_with'] = 'start' # string | Filter to tasks with custom field that starts with provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.ends_with'] = 'end' # string | Filter to tasks with custom field that ends in provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.contains'] = 'first' # string | Filter to tasks with custom field that contains the provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.less_than'] = 10 # number | Filter to tasks with custom field with number value less than the provided number. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field +opts['custom_fields.123.greater_than'] = 100 # number | Filter to tasks with custom field with number value greater than the provided number. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + +try: + # Search tasks in a workspace + api_response = tasks_api_instance.search_tasks_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TasksApi->search_tasks_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **text** | **str**| Performs full-text search on both task name and description | [optional] + **resource_subtype** | **str**| Filters results by the task's resource_subtype | [optional] [default to milestone] + **assignee.any** | **str**| Comma-separated list of user identifiers | [optional] + **assignee.not** | **str**| Comma-separated list of user identifiers | [optional] + **portfolios.any** | **str**| Comma-separated list of portfolio IDs | [optional] + **projects.any** | **str**| Comma-separated list of project IDs | [optional] + **projects.not** | **str**| Comma-separated list of project IDs | [optional] + **projects.all** | **str**| Comma-separated list of project IDs | [optional] + **sections.any** | **str**| Comma-separated list of section or column IDs | [optional] + **sections.not** | **str**| Comma-separated list of section or column IDs | [optional] + **sections.all** | **str**| Comma-separated list of section or column IDs | [optional] + **tags.any** | **str**| Comma-separated list of tag IDs | [optional] + **tags.not** | **str**| Comma-separated list of tag IDs | [optional] + **tags.all** | **str**| Comma-separated list of tag IDs | [optional] + **teams.any** | **str**| Comma-separated list of team IDs | [optional] + **followers.not** | **str**| Comma-separated list of user identifiers | [optional] + **created_by.any** | **str**| Comma-separated list of user identifiers | [optional] + **created_by.not** | **str**| Comma-separated list of user identifiers | [optional] + **assigned_by.any** | **str**| Comma-separated list of user identifiers | [optional] + **assigned_by.not** | **str**| Comma-separated list of user identifiers | [optional] + **liked_by.not** | **str**| Comma-separated list of user identifiers | [optional] + **commented_on_by.not** | **str**| Comma-separated list of user identifiers | [optional] + **due_on.before** | **date**| ISO 8601 date string | [optional] + **due_on.after** | **date**| ISO 8601 date string | [optional] + **due_on** | **date**| ISO 8601 date string or `null` | [optional] + **due_at.before** | **datetime**| ISO 8601 datetime string | [optional] + **due_at.after** | **datetime**| ISO 8601 datetime string | [optional] + **start_on.before** | **date**| ISO 8601 date string | [optional] + **start_on.after** | **date**| ISO 8601 date string | [optional] + **start_on** | **date**| ISO 8601 date string or `null` | [optional] + **created_on.before** | **date**| ISO 8601 date string | [optional] + **created_on.after** | **date**| ISO 8601 date string | [optional] + **created_on** | **date**| ISO 8601 date string or `null` | [optional] + **created_at.before** | **datetime**| ISO 8601 datetime string | [optional] + **created_at.after** | **datetime**| ISO 8601 datetime string | [optional] + **completed_on.before** | **date**| ISO 8601 date string | [optional] + **completed_on.after** | **date**| ISO 8601 date string | [optional] + **completed_on** | **date**| ISO 8601 date string or `null` | [optional] + **completed_at.before** | **datetime**| ISO 8601 datetime string | [optional] + **completed_at.after** | **datetime**| ISO 8601 datetime string | [optional] + **modified_on.before** | **date**| ISO 8601 date string | [optional] + **modified_on.after** | **date**| ISO 8601 date string | [optional] + **modified_on** | **date**| ISO 8601 date string or `null` | [optional] + **modified_at.before** | **datetime**| ISO 8601 datetime string | [optional] + **modified_at.after** | **datetime**| ISO 8601 datetime string | [optional] + **is_blocking** | **bool**| Filter to incomplete tasks with dependents | [optional] + **is_blocked** | **bool**| Filter to tasks with incomplete dependencies | [optional] + **has_attachment** | **bool**| Filter to tasks with attachments | [optional] + **completed** | **bool**| Filter to completed tasks | [optional] + **is_subtask** | **bool**| Filter to subtasks | [optional] + **sort_by** | **str**| One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at` | [optional] [default to modified_at] + **sort_ascending** | **bool**| Default `false` | [optional] [default to false] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **set_parent_for_task** + +Set the parent of a task + +parent, or no parent task at all. Returns an empty data block. When using `insert_before` and `insert_after`, at most one of those two options can be specified, and they must already be subtasks of the parent. + +([more information](https://developers.asana.com/reference/setparentfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new parent of the subtask. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Set the parent of a task + api_response = tasks_api_instance.set_parent_for_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->set_parent_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The new parent of the subtask. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_task** + +Update a task + +A specific, existing task can be updated by making a PUT request on the URL for that task. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated task record. + +([more information](https://developers.asana.com/reference/updatetask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +tasks_api_instance = asana.TasksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The task to update. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a task + api_response = tasks_api_instance.update_task(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TasksApi->update_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The task to update. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TasksApi.yaml b/docs/TasksApi.yaml new file mode 100644 index 00000000..23960bf7 --- /dev/null +++ b/docs/TasksApi.yaml @@ -0,0 +1,661 @@ +TasksApi: + add_dependencies_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to set as dependencies. + task_gid = "321654" # str | The task to operate on. + + + try: + # Set dependencies for a task + api_response = tasks_api_instance.add_dependencies_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->add_dependencies_for_task: %s\n" % e) + add_dependents_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to add as dependents. + task_gid = "321654" # str | The task to operate on. + + + try: + # Set dependents for a task + api_response = tasks_api_instance.add_dependents_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->add_dependents_for_task: %s\n" % e) + add_followers_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to add to the task. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add followers to a task + api_response = tasks_api_instance.add_followers_for_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->add_followers_for_task: %s\n" % e) + add_project_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project to add the task to. + task_gid = "321654" # str | The task to operate on. + + + try: + # Add a project to a task + api_response = tasks_api_instance.add_project_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->add_project_for_task: %s\n" % e) + add_tag_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to add to the task. + task_gid = "321654" # str | The task to operate on. + + + try: + # Add a tag to a task + api_response = tasks_api_instance.add_tag_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->add_tag_for_task: %s\n" % e) + create_subtask_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new subtask to create. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a subtask + api_response = tasks_api_instance.create_subtask_for_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->create_subtask_for_task: %s\n" % e) + create_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The task to create. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a task + api_response = tasks_api_instance.create_task(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->create_task: %s\n" % e) + delete_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + task_gid = "321654" # str | The task to operate on. + + + try: + # Delete a task + api_response = tasks_api_instance.delete_task(task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->delete_task: %s\n" % e) + duplicate_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Describes the duplicate's name and the fields that will be duplicated. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "new_project,new_project.name,new_project_template,new_project_template.name,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Duplicate a task + api_response = tasks_api_instance.duplicate_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->duplicate_task: %s\n" % e) + get_dependencies_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get dependencies from a task + api_response = tasks_api_instance.get_dependencies_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_dependencies_for_task: %s\n" % e) + get_dependents_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get dependents from a task + api_response = tasks_api_instance.get_dependents_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_dependents_for_task: %s\n" % e) + get_subtasks_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get subtasks from a task + api_response = tasks_api_instance.get_subtasks_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_subtasks_for_task: %s\n" % e) + get_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a task + api_response = tasks_api_instance.get_task(task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->get_task: %s\n" % e) + get_tasks: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'assignee': "14641", # str | The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.* + 'project': "321654", # str | The project to filter tasks on. + 'section': "321654", # str | The section to filter tasks on. + 'workspace': "321654", # str | The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.* + 'completed_since': '2012-02-22T02:06:58.158Z', # datetime | Only return tasks that are either incomplete or that have been completed since this time. + 'modified_since': '2012-02-22T02:06:58.158Z', # datetime | Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.* + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple tasks + api_response = tasks_api_instance.get_tasks(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_tasks: %s\n" % e) + get_tasks_for_project: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + project_gid = "1331" # str | Globally unique identifier for the project. + opts = { + 'completed_since': "2012-02-22T02:06:58.158Z", # str | Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get tasks from a project + api_response = tasks_api_instance.get_tasks_for_project(project_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_project: %s\n" % e) + get_tasks_for_section: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + section_gid = "321654" # str | The globally unique identifier for the section. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'completed_since': "2012-02-22T02:06:58.158Z", # str | Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get tasks from a section + api_response = tasks_api_instance.get_tasks_for_section(section_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_section: %s\n" % e) + get_tasks_for_tag: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + tag_gid = "11235" # str | Globally unique identifier for the tag. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get tasks from a tag + api_response = tasks_api_instance.get_tasks_for_tag(tag_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_tag: %s\n" % e) + get_tasks_for_user_task_list: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + user_task_list_gid = "12345" # str | Globally unique identifier for the user task list. + opts = { + 'completed_since': "2012-02-22T02:06:58.158Z", # str | Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get tasks from a user task list + api_response = tasks_api_instance.get_tasks_for_user_task_list(user_task_list_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->get_tasks_for_user_task_list: %s\n" % e) + remove_dependencies_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to unlink as dependencies. + task_gid = "321654" # str | The task to operate on. + + + try: + # Unlink dependencies from a task + api_response = tasks_api_instance.remove_dependencies_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->remove_dependencies_for_task: %s\n" % e) + remove_dependents_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The list of tasks to remove as dependents. + task_gid = "321654" # str | The task to operate on. + + + try: + # Unlink dependents from a task + api_response = tasks_api_instance.remove_dependents_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->remove_dependents_for_task: %s\n" % e) + remove_follower_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The followers to remove from the task. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Remove followers from a task + api_response = tasks_api_instance.remove_follower_for_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->remove_follower_for_task: %s\n" % e) + remove_project_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The project to remove the task from. + task_gid = "321654" # str | The task to operate on. + + + try: + # Remove a project from a task + api_response = tasks_api_instance.remove_project_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->remove_project_for_task: %s\n" % e) + remove_tag_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The tag to remove from the task. + task_gid = "321654" # str | The task to operate on. + + + try: + # Remove a tag from a task + api_response = tasks_api_instance.remove_tag_for_task(body, task_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->remove_tag_for_task: %s\n" % e) + search_tasks_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'text': "Bug", # str | Performs full-text search on both task name and description + 'resource_subtype': "milestone", # str | Filters results by the task's resource_subtype + 'assignee.any': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'assignee.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'portfolios.any': "12345,23456,34567", # str | Comma-separated list of portfolio IDs + 'projects.any': "12345,23456,34567", # str | Comma-separated list of project IDs + 'projects.not': "12345,23456,34567", # str | Comma-separated list of project IDs + 'projects.all': "12345,23456,34567", # str | Comma-separated list of project IDs + 'sections.any': "12345,23456,34567", # str | Comma-separated list of section or column IDs + 'sections.not': "12345,23456,34567", # str | Comma-separated list of section or column IDs + 'sections.all': "12345,23456,34567", # str | Comma-separated list of section or column IDs + 'tags.any': "12345,23456,34567", # str | Comma-separated list of tag IDs + 'tags.not': "12345,23456,34567", # str | Comma-separated list of tag IDs + 'tags.all': "12345,23456,34567", # str | Comma-separated list of tag IDs + 'teams.any': "12345,23456,34567", # str | Comma-separated list of team IDs + 'followers.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'created_by.any': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'created_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'assigned_by.any': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'assigned_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'liked_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'commented_on_by.not': "12345,23456,34567", # str | Comma-separated list of user identifiers + 'due_on.before': '2019-09-15', # date | ISO 8601 date string + 'due_on.after': '2019-09-15', # date | ISO 8601 date string + 'due_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'due_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'due_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'start_on.before': '2019-09-15', # date | ISO 8601 date string + 'start_on.after': '2019-09-15', # date | ISO 8601 date string + 'start_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'created_on.before': '2019-09-15', # date | ISO 8601 date string + 'created_on.after': '2019-09-15', # date | ISO 8601 date string + 'created_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'created_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'created_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'completed_on.before': '2019-09-15', # date | ISO 8601 date string + 'completed_on.after': '2019-09-15', # date | ISO 8601 date string + 'completed_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'completed_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'completed_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'modified_on.before': '2019-09-15', # date | ISO 8601 date string + 'modified_on.after': '2019-09-15', # date | ISO 8601 date string + 'modified_on': '2019-09-15', # date | ISO 8601 date string or `null` + 'modified_at.before': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'modified_at.after': '2019-04-15T01:01:46.055Z', # datetime | ISO 8601 datetime string + 'is_blocking': False, # bool | Filter to incomplete tasks with dependents + 'is_blocked': False, # bool | Filter to tasks with incomplete dependencies + 'has_attachment': False, # bool | Filter to tasks with attachments + 'completed': False, # bool | Filter to completed tasks + 'is_subtask': False, # bool | Filter to subtasks + 'sort_by': "modified_at", # str | One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at` + 'sort_ascending': True, # bool | Default `false` + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + opts['custom_fields.123.is_set'] = True # bool | Filiter to tasks with custom field set or unset. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + opts['custom_fields.123.value'] = '456' # str or bool or Enum option ID | Filter to tasks with custom field that matches the provided value. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + opts['custom_fields.123.starts_with'] = 'start' # string | Filter to tasks with custom field that starts with provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + opts['custom_fields.123.ends_with'] = 'end' # string | Filter to tasks with custom field that ends in provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + opts['custom_fields.123.contains'] = 'first' # string | Filter to tasks with custom field that contains the provided string. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + opts['custom_fields.123.less_than'] = 10 # number | Filter to tasks with custom field with number value less than the provided number. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + opts['custom_fields.123.greater_than'] = 100 # number | Filter to tasks with custom field with number value greater than the provided number. Note: searching for multiple exact matches of a custom field, searching for multi-enum custom field + + try: + # Search tasks in a workspace + api_response = tasks_api_instance.search_tasks_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TasksApi->search_tasks_for_workspace: %s\n" % e) + set_parent_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The new parent of the subtask. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Set the parent of a task + api_response = tasks_api_instance.set_parent_for_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->set_parent_for_task: %s\n" % e) + update_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + tasks_api_instance = asana.TasksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The task to update. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,parent,parent.created_by,parent.name,parent.resource_subtype,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a task + api_response = tasks_api_instance.update_task(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TasksApi->update_task: %s\n" % e) diff --git a/docs/TeamMembershipsApi.md b/docs/TeamMembershipsApi.md new file mode 100644 index 00000000..4bacd1f5 --- /dev/null +++ b/docs/TeamMembershipsApi.md @@ -0,0 +1,236 @@ +# asana.TeamMembershipsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_team_membership**](TeamMembershipsApi.md#get_team_membership) | **GET** /team_memberships/{team_membership_gid} | Get a team membership +[**get_team_memberships**](TeamMembershipsApi.md#get_team_memberships) | **GET** /team_memberships | Get team memberships +[**get_team_memberships_for_team**](TeamMembershipsApi.md#get_team_memberships_for_team) | **GET** /teams/{team_gid}/team_memberships | Get memberships from a team +[**get_team_memberships_for_user**](TeamMembershipsApi.md#get_team_memberships_for_user) | **GET** /users/{user_gid}/team_memberships | Get memberships from a user + +# **get_team_membership** + +Get a team membership + +Returns the complete team membership record for a single team membership. + +([more information](https://developers.asana.com/reference/getteammembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +team_memberships_api_instance = asana.TeamMembershipsApi(api_client) +team_membership_gid = "724362" # str | +opts = { + 'opt_fields': "is_admin,is_guest,is_limited_access,team,team.name,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a team membership + api_response = team_memberships_api_instance.get_team_membership(team_membership_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **team_membership_gid** | **str**| | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_team_memberships** + +Get team memberships + +Returns compact team membership records. + +([more information](https://developers.asana.com/reference/getteammemberships)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +team_memberships_api_instance = asana.TeamMembershipsApi(api_client) +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'team': "159874", # str | Globally unique identifier for the team. + 'user': "512241", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter. + 'workspace': "31326", # str | Globally unique identifier for the workspace. This parameter must be used with the user parameter. + 'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get team memberships + api_response = team_memberships_api_instance.get_team_memberships(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_memberships: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **team** | **str**| Globally unique identifier for the team. | [optional] + **user** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter. | [optional] + **workspace** | **str**| Globally unique identifier for the workspace. This parameter must be used with the user parameter. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_team_memberships_for_team** + +Get memberships from a team + +Returns the compact team memberships for the team. + +([more information](https://developers.asana.com/reference/getteammembershipsforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +team_memberships_api_instance = asana.TeamMembershipsApi(api_client) +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get memberships from a team + api_response = team_memberships_api_instance.get_team_memberships_for_team(team_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_memberships_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **team_gid** | **str**| Globally unique identifier for the team. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_team_memberships_for_user** + +Get memberships from a user + +Returns the compact team membership records for the user. + +([more information](https://developers.asana.com/reference/getteammembershipsforuser)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +team_memberships_api_instance = asana.TeamMembershipsApi(api_client) +user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +workspace = "31326" # str | Globally unique identifier for the workspace. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get memberships from a user + api_response = team_memberships_api_instance.get_team_memberships_for_user(user_gid, workspace, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_memberships_for_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_gid** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | + **workspace** | **str**| Globally unique identifier for the workspace. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TeamMembershipsApi.yaml b/docs/TeamMembershipsApi.yaml new file mode 100644 index 00000000..622b0659 --- /dev/null +++ b/docs/TeamMembershipsApi.yaml @@ -0,0 +1,101 @@ +TeamMembershipsApi: + get_team_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + team_memberships_api_instance = asana.TeamMembershipsApi(api_client) + team_membership_gid = "724362" # str | + opts = { + 'opt_fields': "is_admin,is_guest,is_limited_access,team,team.name,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a team membership + api_response = team_memberships_api_instance.get_team_membership(team_membership_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_membership: %s\n" % e) + get_team_memberships: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + team_memberships_api_instance = asana.TeamMembershipsApi(api_client) + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'team': "159874", # str | Globally unique identifier for the team. + 'user': "512241", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter. + 'workspace': "31326", # str | Globally unique identifier for the workspace. This parameter must be used with the user parameter. + 'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get team memberships + api_response = team_memberships_api_instance.get_team_memberships(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_memberships: %s\n" % e) + get_team_memberships_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + team_memberships_api_instance = asana.TeamMembershipsApi(api_client) + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get memberships from a team + api_response = team_memberships_api_instance.get_team_memberships_for_team(team_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_memberships_for_team: %s\n" % e) + get_team_memberships_for_user: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + team_memberships_api_instance = asana.TeamMembershipsApi(api_client) + user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + workspace = "31326" # str | Globally unique identifier for the workspace. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get memberships from a user + api_response = team_memberships_api_instance.get_team_memberships_for_user(user_gid, workspace, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TeamMembershipsApi->get_team_memberships_for_user: %s\n" % e) diff --git a/docs/TeamsApi.md b/docs/TeamsApi.md new file mode 100644 index 00000000..2798bee5 --- /dev/null +++ b/docs/TeamsApi.md @@ -0,0 +1,386 @@ +# asana.TeamsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_user_for_team**](TeamsApi.md#add_user_for_team) | **POST** /teams/{team_gid}/addUser | Add a user to a team +[**create_team**](TeamsApi.md#create_team) | **POST** /teams | Create a team +[**get_team**](TeamsApi.md#get_team) | **GET** /teams/{team_gid} | Get a team +[**get_teams_for_user**](TeamsApi.md#get_teams_for_user) | **GET** /users/{user_gid}/teams | Get teams for a user +[**get_teams_for_workspace**](TeamsApi.md#get_teams_for_workspace) | **GET** /workspaces/{workspace_gid}/teams | Get teams in a workspace +[**remove_user_for_team**](TeamsApi.md#remove_user_for_team) | **POST** /teams/{team_gid}/removeUser | Remove a user from a team +[**update_team**](TeamsApi.md#update_team) | **PUT** /teams/{team_gid} | Update a team + +# **add_user_for_team** + +Add a user to a team + +The user making this call must be a member of the team in order to add others. The user being added must exist in the same organization as the team. Returns the complete team membership record for the newly added user. + +([more information](https://developers.asana.com/reference/adduserforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to add to the team. +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'opt_fields': "is_admin,is_guest,is_limited_access,team,team.name,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add a user to a team + api_response = teams_api_instance.add_user_for_team(body, team_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TeamsApi->add_user_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The user to add to the team. | + **team_gid** | **str**| Globally unique identifier for the team. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **create_team** + +Create a team + +Creates a team within the current workspace. + +([more information](https://developers.asana.com/reference/createteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The team to create. +opts = { + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_member_removal_access_level,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a team + api_response = teams_api_instance.create_team(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TeamsApi->create_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The team to create. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_team** + +Get a team + +Returns the full record for a single team. + +([more information](https://developers.asana.com/reference/getteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_member_removal_access_level,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a team + api_response = teams_api_instance.get_team(team_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TeamsApi->get_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **team_gid** | **str**| Globally unique identifier for the team. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_teams_for_user** + +Get teams for a user + +Returns the compact records for all teams to which the given user is assigned. + +([more information](https://developers.asana.com/reference/getteamsforuser)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +organization = "1331" # str | The workspace or organization to filter teams on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,offset,organization,organization.name,path,permalink_url,team_member_removal_access_level,uri,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get teams for a user + api_response = teams_api_instance.get_teams_for_user(user_gid, organization, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TeamsApi->get_teams_for_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_gid** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | + **organization** | **str**| The workspace or organization to filter teams on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_teams_for_workspace** + +Get teams in a workspace + +Returns the compact records for all teams in the workspace visible to the authorized user. + +([more information](https://developers.asana.com/reference/getteamsforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,offset,organization,organization.name,path,permalink_url,team_member_removal_access_level,uri,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get teams in a workspace + api_response = teams_api_instance.get_teams_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TeamsApi->get_teams_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_user_for_team** + +Remove a user from a team + +The user making this call must be a member of the team in order to remove themselves or others. + +([more information](https://developers.asana.com/reference/removeuserforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to remove from the team. +team_gid = "159874" # str | Globally unique identifier for the team. + + +try: + # Remove a user from a team + api_response = teams_api_instance.remove_user_for_team(body, team_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TeamsApi->remove_user_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The user to remove from the team. | + **team_gid** | **str**| Globally unique identifier for the team. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_team** + +Update a team + +Updates a team within the current workspace. + +([more information](https://developers.asana.com/reference/updateteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +teams_api_instance = asana.TeamsApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The team to update. +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_member_removal_access_level,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a team + api_response = teams_api_instance.update_team(body, team_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TeamsApi->update_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The team to update. | + **team_gid** | **str**| Globally unique identifier for the team. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TeamsApi.yaml b/docs/TeamsApi.yaml new file mode 100644 index 00000000..856ed224 --- /dev/null +++ b/docs/TeamsApi.yaml @@ -0,0 +1,163 @@ +TeamsApi: + add_user_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to add to the team. + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'opt_fields': "is_admin,is_guest,is_limited_access,team,team.name,user,user.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add a user to a team + api_response = teams_api_instance.add_user_for_team(body, team_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TeamsApi->add_user_for_team: %s\n" % e) + create_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The team to create. + opts = { + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_member_removal_access_level,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a team + api_response = teams_api_instance.create_team(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TeamsApi->create_team: %s\n" % e) + get_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_member_removal_access_level,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a team + api_response = teams_api_instance.get_team(team_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TeamsApi->get_team: %s\n" % e) + get_teams_for_user: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + organization = "1331" # str | The workspace or organization to filter teams on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,offset,organization,organization.name,path,permalink_url,team_member_removal_access_level,uri,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get teams for a user + api_response = teams_api_instance.get_teams_for_user(user_gid, organization, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TeamsApi->get_teams_for_user: %s\n" % e) + get_teams_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,offset,organization,organization.name,path,permalink_url,team_member_removal_access_level,uri,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get teams in a workspace + api_response = teams_api_instance.get_teams_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TeamsApi->get_teams_for_workspace: %s\n" % e) + remove_user_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to remove from the team. + team_gid = "159874" # str | Globally unique identifier for the team. + + + try: + # Remove a user from a team + api_response = teams_api_instance.remove_user_for_team(body, team_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TeamsApi->remove_user_for_team: %s\n" % e) + update_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + teams_api_instance = asana.TeamsApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The team to update. + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_member_removal_access_level,visibility" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a team + api_response = teams_api_instance.update_team(body, team_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TeamsApi->update_team: %s\n" % e) diff --git a/docs/TimePeriodsApi.md b/docs/TimePeriodsApi.md new file mode 100644 index 00000000..f5e716f1 --- /dev/null +++ b/docs/TimePeriodsApi.md @@ -0,0 +1,120 @@ +# asana.TimePeriodsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_time_period**](TimePeriodsApi.md#get_time_period) | **GET** /time_periods/{time_period_gid} | Get a time period +[**get_time_periods**](TimePeriodsApi.md#get_time_periods) | **GET** /time_periods | Get time periods + +# **get_time_period** + +Get a time period + +Returns the full record for a single time period. + +([more information](https://developers.asana.com/reference/gettimeperiod)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_periods_api_instance = asana.TimePeriodsApi(api_client) +time_period_gid = "917392" # str | Globally unique identifier for the time period. +opts = { + 'opt_fields': "display_name,end_on,parent,parent.display_name,parent.end_on,parent.period,parent.start_on,period,start_on" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a time period + api_response = time_periods_api_instance.get_time_period(time_period_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TimePeriodsApi->get_time_period: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **time_period_gid** | **str**| Globally unique identifier for the time period. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_time_periods** + +Get time periods + +Returns compact time period records. + +([more information](https://developers.asana.com/reference/gettimeperiods)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_periods_api_instance = asana.TimePeriodsApi(api_client) +workspace = "31326" # str | Globally unique identifier for the workspace. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'start_on': '2019-09-15', # date | ISO 8601 date string + 'end_on': '2019-09-15', # date | ISO 8601 date string + 'opt_fields': "display_name,end_on,offset,parent,parent.display_name,parent.end_on,parent.period,parent.start_on,path,period,start_on,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get time periods + api_response = time_periods_api_instance.get_time_periods(workspace, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TimePeriodsApi->get_time_periods: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace** | **str**| Globally unique identifier for the workspace. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **start_on** | **date**| ISO 8601 date string | [optional] + **end_on** | **date**| ISO 8601 date string | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TimePeriodsApi.yaml b/docs/TimePeriodsApi.yaml new file mode 100644 index 00000000..213f9412 --- /dev/null +++ b/docs/TimePeriodsApi.yaml @@ -0,0 +1,50 @@ +TimePeriodsApi: + get_time_period: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_periods_api_instance = asana.TimePeriodsApi(api_client) + time_period_gid = "917392" # str | Globally unique identifier for the time period. + opts = { + 'opt_fields': "display_name,end_on,parent,parent.display_name,parent.end_on,parent.period,parent.start_on,period,start_on" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a time period + api_response = time_periods_api_instance.get_time_period(time_period_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TimePeriodsApi->get_time_period: %s\n" % e) + get_time_periods: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_periods_api_instance = asana.TimePeriodsApi(api_client) + workspace = "31326" # str | Globally unique identifier for the workspace. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'start_on': '2019-09-15', # date | ISO 8601 date string + 'end_on': '2019-09-15', # date | ISO 8601 date string + 'opt_fields': "display_name,end_on,offset,parent,parent.display_name,parent.end_on,parent.period,parent.start_on,path,period,start_on,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get time periods + api_response = time_periods_api_instance.get_time_periods(workspace, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TimePeriodsApi->get_time_periods: %s\n" % e) diff --git a/docs/TimeTrackingEntriesApi.md b/docs/TimeTrackingEntriesApi.md new file mode 100644 index 00000000..58427a71 --- /dev/null +++ b/docs/TimeTrackingEntriesApi.md @@ -0,0 +1,273 @@ +# asana.TimeTrackingEntriesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_time_tracking_entry**](TimeTrackingEntriesApi.md#create_time_tracking_entry) | **POST** /tasks/{task_gid}/time_tracking_entries | Create a time tracking entry +[**delete_time_tracking_entry**](TimeTrackingEntriesApi.md#delete_time_tracking_entry) | **DELETE** /time_tracking_entries/{time_tracking_entry_gid} | Delete a time tracking entry +[**get_time_tracking_entries_for_task**](TimeTrackingEntriesApi.md#get_time_tracking_entries_for_task) | **GET** /tasks/{task_gid}/time_tracking_entries | Get time tracking entries for a task +[**get_time_tracking_entry**](TimeTrackingEntriesApi.md#get_time_tracking_entry) | **GET** /time_tracking_entries/{time_tracking_entry_gid} | Get a time tracking entry +[**update_time_tracking_entry**](TimeTrackingEntriesApi.md#update_time_tracking_entry) | **PUT** /time_tracking_entries/{time_tracking_entry_gid} | Update a time tracking entry + +# **create_time_tracking_entry** + +Create a time tracking entry + +Creates a time tracking entry on a given task. Returns the record of the newly created time tracking entry. + +([more information](https://developers.asana.com/reference/createtimetrackingentry)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the time tracking entry. +task_gid = "321654" # str | The task to operate on. +opts = { + 'opt_fields': "created_at,created_by,created_by.name,duration_minutes,entered_on,task,task.created_by,task.name,task.resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Create a time tracking entry + api_response = time_tracking_entries_api_instance.create_time_tracking_entry(body, task_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->create_time_tracking_entry: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| Information about the time tracking entry. | + **task_gid** | **str**| The task to operate on. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_time_tracking_entry** + +Delete a time tracking entry + +A specific, existing time tracking entry can be deleted by making a `DELETE` request on the URL for that time tracking entry. Returns an empty data record. + +([more information](https://developers.asana.com/reference/deletetimetrackingentry)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) +time_tracking_entry_gid = "917392" # str | Globally unique identifier for the time tracking entry. + + +try: + # Delete a time tracking entry + api_response = time_tracking_entries_api_instance.delete_time_tracking_entry(time_tracking_entry_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->delete_time_tracking_entry: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **time_tracking_entry_gid** | **str**| Globally unique identifier for the time tracking entry. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_time_tracking_entries_for_task** + +Get time tracking entries for a task + +Returns time tracking entries for a given task. + +([more information](https://developers.asana.com/reference/gettimetrackingentriesfortask)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) +task_gid = "321654" # str | The task to operate on. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "created_by,created_by.name,duration_minutes,entered_on,offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get time tracking entries for a task + api_response = time_tracking_entries_api_instance.get_time_tracking_entries_for_task(task_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->get_time_tracking_entries_for_task: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_gid** | **str**| The task to operate on. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_time_tracking_entry** + +Get a time tracking entry + +Returns the complete time tracking entry record for a single time tracking entry. + +([more information](https://developers.asana.com/reference/gettimetrackingentry)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) +time_tracking_entry_gid = "917392" # str | Globally unique identifier for the time tracking entry. +opts = { + 'opt_fields': "created_at,created_by,created_by.name,duration_minutes,entered_on,task,task.created_by,task.name,task.resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a time tracking entry + api_response = time_tracking_entries_api_instance.get_time_tracking_entry(time_tracking_entry_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->get_time_tracking_entry: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **time_tracking_entry_gid** | **str**| Globally unique identifier for the time tracking entry. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_time_tracking_entry** + +Update a time tracking entry + +A specific, existing time tracking entry can be updated by making a `PUT` request on the URL for that time tracking entry. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated time tracking entry record. + +([more information](https://developers.asana.com/reference/updatetimetrackingentry)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the time tracking entry. +time_tracking_entry_gid = "917392" # str | Globally unique identifier for the time tracking entry. +opts = { + 'opt_fields': "created_at,created_by,created_by.name,duration_minutes,entered_on,task,task.created_by,task.name,task.resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a time tracking entry + api_response = time_tracking_entries_api_instance.update_time_tracking_entry(body, time_tracking_entry_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->update_time_tracking_entry: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated fields for the time tracking entry. | + **time_tracking_entry_gid** | **str**| Globally unique identifier for the time tracking entry. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TimeTrackingEntriesApi.yaml b/docs/TimeTrackingEntriesApi.yaml new file mode 100644 index 00000000..7b112362 --- /dev/null +++ b/docs/TimeTrackingEntriesApi.yaml @@ -0,0 +1,114 @@ +TimeTrackingEntriesApi: + create_time_tracking_entry: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | Information about the time tracking entry. + task_gid = "321654" # str | The task to operate on. + opts = { + 'opt_fields': "created_at,created_by,created_by.name,duration_minutes,entered_on,task,task.created_by,task.name,task.resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Create a time tracking entry + api_response = time_tracking_entries_api_instance.create_time_tracking_entry(body, task_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->create_time_tracking_entry: %s\n" % e) + delete_time_tracking_entry: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) + time_tracking_entry_gid = "917392" # str | Globally unique identifier for the time tracking entry. + + + try: + # Delete a time tracking entry + api_response = time_tracking_entries_api_instance.delete_time_tracking_entry(time_tracking_entry_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->delete_time_tracking_entry: %s\n" % e) + get_time_tracking_entries_for_task: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) + task_gid = "321654" # str | The task to operate on. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "created_by,created_by.name,duration_minutes,entered_on,offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get time tracking entries for a task + api_response = time_tracking_entries_api_instance.get_time_tracking_entries_for_task(task_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->get_time_tracking_entries_for_task: %s\n" % e) + get_time_tracking_entry: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) + time_tracking_entry_gid = "917392" # str | Globally unique identifier for the time tracking entry. + opts = { + 'opt_fields': "created_at,created_by,created_by.name,duration_minutes,entered_on,task,task.created_by,task.name,task.resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a time tracking entry + api_response = time_tracking_entries_api_instance.get_time_tracking_entry(time_tracking_entry_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->get_time_tracking_entry: %s\n" % e) + update_time_tracking_entry: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + time_tracking_entries_api_instance = asana.TimeTrackingEntriesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated fields for the time tracking entry. + time_tracking_entry_gid = "917392" # str | Globally unique identifier for the time tracking entry. + opts = { + 'opt_fields': "created_at,created_by,created_by.name,duration_minutes,entered_on,task,task.created_by,task.name,task.resource_subtype" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a time tracking entry + api_response = time_tracking_entries_api_instance.update_time_tracking_entry(body, time_tracking_entry_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling TimeTrackingEntriesApi->update_time_tracking_entry: %s\n" % e) diff --git a/docs/TypeaheadApi.md b/docs/TypeaheadApi.md new file mode 100644 index 00000000..7741c253 --- /dev/null +++ b/docs/TypeaheadApi.md @@ -0,0 +1,68 @@ +# asana.TypeaheadApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**typeahead_for_workspace**](TypeaheadApi.md#typeahead_for_workspace) | **GET** /workspaces/{workspace_gid}/typeahead | Get objects via typeahead + +# **typeahead_for_workspace** + +Get objects via typeahead + +Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type `user` are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, messages, etc. Resources with type `project` are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type `task` are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Resources with type `project_template` are returned with priority placed on favorited project templates. Leaving the `query` string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token. + +([more information](https://developers.asana.com/reference/typeaheadforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +typeahead_api_instance = asana.TypeaheadApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +resource_type = "user" # str | The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `project`, `project_template`, `portfolio`, `tag`, `task`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported. +opts = { + 'type': "user", # str | *Deprecated: new integrations should prefer the resource_type field.* + 'query': "Greg", # str | The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results. + 'count': 20, # int | The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned. + 'opt_fields': "name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get objects via typeahead + api_response = typeahead_api_instance.typeahead_for_workspace(workspace_gid, resource_type, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling TypeaheadApi->typeahead_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **resource_type** | **str**| The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `project`, `project_template`, `portfolio`, `tag`, `task`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported. | [default to user] + **type** | **str**| *Deprecated: new integrations should prefer the resource_type field.* | [optional] [default to user] + **query** | **str**| The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results. | [optional] + **count** | **int**| The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TypeaheadApi.yaml b/docs/TypeaheadApi.yaml new file mode 100644 index 00000000..cac33229 --- /dev/null +++ b/docs/TypeaheadApi.yaml @@ -0,0 +1,28 @@ +TypeaheadApi: + typeahead_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + typeahead_api_instance = asana.TypeaheadApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + resource_type = "user" # str | The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `project`, `project_template`, `portfolio`, `tag`, `task`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported. + opts = { + 'type': "user", # str | *Deprecated: new integrations should prefer the resource_type field.* + 'query': "Greg", # str | The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results. + 'count': 20, # int | The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned. + 'opt_fields': "name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get objects via typeahead + api_response = typeahead_api_instance.typeahead_for_workspace(workspace_gid, resource_type, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling TypeaheadApi->typeahead_for_workspace: %s\n" % e) diff --git a/docs/UserTaskListsApi.md b/docs/UserTaskListsApi.md new file mode 100644 index 00000000..61734b5e --- /dev/null +++ b/docs/UserTaskListsApi.md @@ -0,0 +1,113 @@ +# asana.UserTaskListsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_user_task_list**](UserTaskListsApi.md#get_user_task_list) | **GET** /user_task_lists/{user_task_list_gid} | Get a user task list +[**get_user_task_list_for_user**](UserTaskListsApi.md#get_user_task_list_for_user) | **GET** /users/{user_gid}/user_task_list | Get a user's task list + +# **get_user_task_list** + +Get a user task list + +Returns the full record for a user task list. + +([more information](https://developers.asana.com/reference/getusertasklist)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +user_task_lists_api_instance = asana.UserTaskListsApi(api_client) +user_task_list_gid = "12345" # str | Globally unique identifier for the user task list. +opts = { + 'opt_fields': "name,owner,workspace" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a user task list + api_response = user_task_lists_api_instance.get_user_task_list(user_task_list_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling UserTaskListsApi->get_user_task_list: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_task_list_gid** | **str**| Globally unique identifier for the user task list. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_user_task_list_for_user** + +Get a user's task list + +Returns the full record for a user's task list. + +([more information](https://developers.asana.com/reference/getusertasklistforuser)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +user_task_lists_api_instance = asana.UserTaskListsApi(api_client) +user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +workspace = "1234" # str | The workspace in which to get the user task list. +opts = { + 'opt_fields': "name,owner,workspace" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a user's task list + api_response = user_task_lists_api_instance.get_user_task_list_for_user(user_gid, workspace, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling UserTaskListsApi->get_user_task_list_for_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_gid** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | + **workspace** | **str**| The workspace in which to get the user task list. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/UserTaskListsApi.yaml b/docs/UserTaskListsApi.yaml new file mode 100644 index 00000000..37c8bad1 --- /dev/null +++ b/docs/UserTaskListsApi.yaml @@ -0,0 +1,46 @@ +UserTaskListsApi: + get_user_task_list: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + user_task_lists_api_instance = asana.UserTaskListsApi(api_client) + user_task_list_gid = "12345" # str | Globally unique identifier for the user task list. + opts = { + 'opt_fields': "name,owner,workspace" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a user task list + api_response = user_task_lists_api_instance.get_user_task_list(user_task_list_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling UserTaskListsApi->get_user_task_list: %s\n" % e) + get_user_task_list_for_user: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + user_task_lists_api_instance = asana.UserTaskListsApi(api_client) + user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + workspace = "1234" # str | The workspace in which to get the user task list. + opts = { + 'opt_fields': "name,owner,workspace" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a user's task list + api_response = user_task_lists_api_instance.get_user_task_list_for_user(user_gid, workspace, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling UserTaskListsApi->get_user_task_list_for_user: %s\n" % e) diff --git a/docs/UsersApi.md b/docs/UsersApi.md new file mode 100644 index 00000000..fd3d062a --- /dev/null +++ b/docs/UsersApi.md @@ -0,0 +1,289 @@ +# asana.UsersApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_favorites_for_user**](UsersApi.md#get_favorites_for_user) | **GET** /users/{user_gid}/favorites | Get a user's favorites +[**get_user**](UsersApi.md#get_user) | **GET** /users/{user_gid} | Get a user +[**get_users**](UsersApi.md#get_users) | **GET** /users | Get multiple users +[**get_users_for_team**](UsersApi.md#get_users_for_team) | **GET** /teams/{team_gid}/users | Get users in a team +[**get_users_for_workspace**](UsersApi.md#get_users_for_workspace) | **GET** /workspaces/{workspace_gid}/users | Get users in a workspace or organization + +# **get_favorites_for_user** + +Get a user's favorites + +Returns all of a user's favorites in the given workspace, of the given type. Results are given in order (The same order as Asana's sidebar). + +([more information](https://developers.asana.com/reference/getfavoritesforuser)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +resource_type = "project" # str | The resource type of favorites to be returned. +workspace = "1234" # str | The workspace in which to get favorites. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "name,offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a user's favorites + api_response = users_api_instance.get_favorites_for_user(user_gid, resource_type, workspace, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling UsersApi->get_favorites_for_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_gid** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | + **resource_type** | **str**| The resource type of favorites to be returned. | [default to project] + **workspace** | **str**| The workspace in which to get favorites. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_user** + +Get a user + +Returns the full user record for the single user with the provided ID. + +([more information](https://developers.asana.com/reference/getuser)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +opts = { + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a user + api_response = users_api_instance.get_user(user_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_gid** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_users** + +Get multiple users + +Returns the user records for all users in all workspaces and organizations accessible to the authenticated user. Accepts an optional workspace ID parameter. Results are sorted by user ID. + +([more information](https://developers.asana.com/reference/getusers)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +opts = { + 'workspace': "1331", # str | The workspace or organization ID to filter users on. + 'team': "15627", # str | The team ID to filter users on. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "email,name,offset,path,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,uri,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple users + api_response = users_api_instance.get_users(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling UsersApi->get_users: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace** | **str**| The workspace or organization ID to filter users on. | [optional] + **team** | **str**| The team ID to filter users on. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_users_for_team** + +Get users in a team + +Returns the compact records for all users that are members of the team. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. + +([more information](https://developers.asana.com/reference/getusersforteam)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +team_gid = "159874" # str | Globally unique identifier for the team. +opts = { + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get users in a team + api_response = users_api_instance.get_users_for_team(team_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling UsersApi->get_users_for_team: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **team_gid** | **str**| Globally unique identifier for the team. | + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_users_for_workspace** + +Get users in a workspace or organization + +Returns the compact records for all users in the specified workspace or organization. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. + +([more information](https://developers.asana.com/reference/getusersforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +users_api_instance = asana.UsersApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get users in a workspace or organization + api_response = users_api_instance.get_users_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling UsersApi->get_users_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/UsersApi.yaml b/docs/UsersApi.yaml new file mode 100644 index 00000000..2fda92b8 --- /dev/null +++ b/docs/UsersApi.yaml @@ -0,0 +1,124 @@ +UsersApi: + get_favorites_for_user: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + users_api_instance = asana.UsersApi(api_client) + user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + resource_type = "project" # str | The resource type of favorites to be returned. + workspace = "1234" # str | The workspace in which to get favorites. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "name,offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a user's favorites + api_response = users_api_instance.get_favorites_for_user(user_gid, resource_type, workspace, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling UsersApi->get_favorites_for_user: %s\n" % e) + get_user: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + users_api_instance = asana.UsersApi(api_client) + user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + opts = { + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a user + api_response = users_api_instance.get_user(user_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling UsersApi->get_user: %s\n" % e) + get_users: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + users_api_instance = asana.UsersApi(api_client) + opts = { + 'workspace': "1331", # str | The workspace or organization ID to filter users on. + 'team': "15627", # str | The team ID to filter users on. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "email,name,offset,path,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,uri,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple users + api_response = users_api_instance.get_users(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling UsersApi->get_users: %s\n" % e) + get_users_for_team: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + users_api_instance = asana.UsersApi(api_client) + team_gid = "159874" # str | Globally unique identifier for the team. + opts = { + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get users in a team + api_response = users_api_instance.get_users_for_team(team_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling UsersApi->get_users_for_team: %s\n" % e) + get_users_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + users_api_instance = asana.UsersApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get users in a workspace or organization + api_response = users_api_instance.get_users_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling UsersApi->get_users_for_workspace: %s\n" % e) diff --git a/docs/WebhooksApi.md b/docs/WebhooksApi.md new file mode 100644 index 00000000..08c68b57 --- /dev/null +++ b/docs/WebhooksApi.md @@ -0,0 +1,273 @@ +# asana.WebhooksApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_webhook**](WebhooksApi.md#create_webhook) | **POST** /webhooks | Establish a webhook +[**delete_webhook**](WebhooksApi.md#delete_webhook) | **DELETE** /webhooks/{webhook_gid} | Delete a webhook +[**get_webhook**](WebhooksApi.md#get_webhook) | **GET** /webhooks/{webhook_gid} | Get a webhook +[**get_webhooks**](WebhooksApi.md#get_webhooks) | **GET** /webhooks | Get multiple webhooks +[**update_webhook**](WebhooksApi.md#update_webhook) | **PUT** /webhooks/{webhook_gid} | Update a webhook + +# **create_webhook** + +Establish a webhook + +Establishing a webhook is a two-part process. First, a simple HTTP POST request initiates the creation similar to creating any other resource. Next, in the middle of this request comes the confirmation handshake. When a webhook is created, we will send a test POST to the target with an `X-Hook-Secret` header. The target must respond with a `200 OK` or `204 No Content` and a matching `X-Hook-Secret` header to confirm that this webhook subscription is indeed expected. We strongly recommend storing this secret to be used to verify future webhook event signatures. The POST request to create the webhook will then return with the status of the request. If you do not acknowledge the webhook’s confirmation handshake it will fail to setup, and you will receive an error in response to your attempt to create it. This means you need to be able to receive and complete the webhook *while* the POST request is in-flight (in other words, have a server that can handle requests asynchronously). Invalid hostnames like localhost will recieve a 403 Forbidden status code. ``` # Request curl -H \"Authorization: Bearer \" \\ -X POST https://app.asana.com/api/1.0/webhooks \\ -d \"resource=8675309\" \\ -d \"target=https://example.com/receive-webhook/7654\" ``` ``` # Handshake sent to https://example.com/ POST /receive-webhook/7654 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Handshake response sent by example.com HTTP/1.1 200 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Response HTTP/1.1 201 { \"data\": { \"gid\": \"43214\", \"resource\": { \"gid\": \"8675309\", \"name\": \"Bugs\" }, \"target\": \"https://example.com/receive-webhook/7654\", \"active\": false, \"last_success_at\": null, \"last_failure_at\": null, \"last_failure_content\": null } } ``` + +([more information](https://developers.asana.com/reference/createwebhook)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +webhooks_api_instance = asana.WebhooksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The webhook workspace and target. +opts = { + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,resource,resource.name,target" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Establish a webhook + api_response = webhooks_api_instance.create_webhook(body, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WebhooksApi->create_webhook: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The webhook workspace and target. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **delete_webhook** + +Delete a webhook + +This method *permanently* removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. + +([more information](https://developers.asana.com/reference/deletewebhook)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +webhooks_api_instance = asana.WebhooksApi(api_client) +webhook_gid = "12345" # str | Globally unique identifier for the webhook. + + +try: + # Delete a webhook + api_response = webhooks_api_instance.delete_webhook(webhook_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling WebhooksApi->delete_webhook: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **webhook_gid** | **str**| Globally unique identifier for the webhook. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_webhook** + +Get a webhook + +Returns the full record for the given webhook. + +([more information](https://developers.asana.com/reference/getwebhook)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +webhooks_api_instance = asana.WebhooksApi(api_client) +webhook_gid = "12345" # str | Globally unique identifier for the webhook. +opts = { + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,resource,resource.name,target" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a webhook + api_response = webhooks_api_instance.get_webhook(webhook_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WebhooksApi->get_webhook: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **webhook_gid** | **str**| Globally unique identifier for the webhook. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_webhooks** + +Get multiple webhooks + +Get the compact representation of all webhooks your app has registered for the authenticated user in the given workspace. + +([more information](https://developers.asana.com/reference/getwebhooks)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +webhooks_api_instance = asana.WebhooksApi(api_client) +workspace = "1331" # str | The workspace to query for webhooks in. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'resource': "51648", # str | Only return webhooks for the given resource. + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,offset,path,resource,resource.name,target,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple webhooks + api_response = webhooks_api_instance.get_webhooks(workspace, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling WebhooksApi->get_webhooks: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace** | **str**| The workspace to query for webhooks in. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **resource** | **str**| Only return webhooks for the given resource. | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_webhook** + +Update a webhook + +An existing webhook's filters can be updated by making a PUT request on the URL for that webhook. Note that the webhook's previous `filters` array will be completely overwritten by the `filters` sent in the PUT request. + +([more information](https://developers.asana.com/reference/updatewebhook)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +webhooks_api_instance = asana.WebhooksApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated filters for the webhook. +webhook_gid = "12345" # str | Globally unique identifier for the webhook. +opts = { + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,resource,resource.name,target" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a webhook + api_response = webhooks_api_instance.update_webhook(body, webhook_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WebhooksApi->update_webhook: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The updated filters for the webhook. | + **webhook_gid** | **str**| Globally unique identifier for the webhook. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/WebhooksApi.yaml b/docs/WebhooksApi.yaml new file mode 100644 index 00000000..89fdc287 --- /dev/null +++ b/docs/WebhooksApi.yaml @@ -0,0 +1,114 @@ +WebhooksApi: + create_webhook: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + webhooks_api_instance = asana.WebhooksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The webhook workspace and target. + opts = { + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,resource,resource.name,target" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Establish a webhook + api_response = webhooks_api_instance.create_webhook(body, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WebhooksApi->create_webhook: %s\n" % e) + delete_webhook: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + webhooks_api_instance = asana.WebhooksApi(api_client) + webhook_gid = "12345" # str | Globally unique identifier for the webhook. + + + try: + # Delete a webhook + api_response = webhooks_api_instance.delete_webhook(webhook_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling WebhooksApi->delete_webhook: %s\n" % e) + get_webhook: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + webhooks_api_instance = asana.WebhooksApi(api_client) + webhook_gid = "12345" # str | Globally unique identifier for the webhook. + opts = { + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,resource,resource.name,target" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a webhook + api_response = webhooks_api_instance.get_webhook(webhook_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WebhooksApi->get_webhook: %s\n" % e) + get_webhooks: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + webhooks_api_instance = asana.WebhooksApi(api_client) + workspace = "1331" # str | The workspace to query for webhooks in. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'resource': "51648", # str | Only return webhooks for the given resource. + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,offset,path,resource,resource.name,target,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple webhooks + api_response = webhooks_api_instance.get_webhooks(workspace, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling WebhooksApi->get_webhooks: %s\n" % e) + update_webhook: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + webhooks_api_instance = asana.WebhooksApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The updated filters for the webhook. + webhook_gid = "12345" # str | Globally unique identifier for the webhook. + opts = { + 'opt_fields': "active,created_at,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,resource,resource.name,target" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a webhook + api_response = webhooks_api_instance.update_webhook(body, webhook_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WebhooksApi->update_webhook: %s\n" % e) diff --git a/docs/WorkspaceMembershipsApi.md b/docs/WorkspaceMembershipsApi.md new file mode 100644 index 00000000..75819826 --- /dev/null +++ b/docs/WorkspaceMembershipsApi.md @@ -0,0 +1,175 @@ +# asana.WorkspaceMembershipsApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_workspace_membership**](WorkspaceMembershipsApi.md#get_workspace_membership) | **GET** /workspace_memberships/{workspace_membership_gid} | Get a workspace membership +[**get_workspace_memberships_for_user**](WorkspaceMembershipsApi.md#get_workspace_memberships_for_user) | **GET** /users/{user_gid}/workspace_memberships | Get workspace memberships for a user +[**get_workspace_memberships_for_workspace**](WorkspaceMembershipsApi.md#get_workspace_memberships_for_workspace) | **GET** /workspaces/{workspace_gid}/workspace_memberships | Get the workspace memberships for a workspace + +# **get_workspace_membership** + +Get a workspace membership + +Returns the complete workspace record for a single workspace membership. + +([more information](https://developers.asana.com/reference/getworkspacemembership)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspace_memberships_api_instance = asana.WorkspaceMembershipsApi(api_client) +workspace_membership_gid = "12345" # str | +opts = { + 'opt_fields': "created_at,is_active,is_admin,is_guest,user,user.name,user_task_list,user_task_list.name,user_task_list.owner,user_task_list.workspace,vacation_dates,vacation_dates.end_on,vacation_dates.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a workspace membership + api_response = workspace_memberships_api_instance.get_workspace_membership(workspace_membership_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WorkspaceMembershipsApi->get_workspace_membership: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_membership_gid** | **str**| | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_workspace_memberships_for_user** + +Get workspace memberships for a user + +Returns the compact workspace membership records for the user. + +([more information](https://developers.asana.com/reference/getworkspacemembershipsforuser)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspace_memberships_api_instance = asana.WorkspaceMembershipsApi(api_client) +user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "created_at,is_active,is_admin,is_guest,offset,path,uri,user,user.name,user_task_list,user_task_list.name,user_task_list.owner,user_task_list.workspace,vacation_dates,vacation_dates.end_on,vacation_dates.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get workspace memberships for a user + api_response = workspace_memberships_api_instance.get_workspace_memberships_for_user(user_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling WorkspaceMembershipsApi->get_workspace_memberships_for_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user_gid** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_workspace_memberships_for_workspace** + +Get the workspace memberships for a workspace + +Returns the compact workspace membership records for the workspace. + +([more information](https://developers.asana.com/reference/getworkspacemembershipsforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspace_memberships_api_instance = asana.WorkspaceMembershipsApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "created_at,is_active,is_admin,is_guest,offset,path,uri,user,user.name,user_task_list,user_task_list.name,user_task_list.owner,user_task_list.workspace,vacation_dates,vacation_dates.end_on,vacation_dates.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get the workspace memberships for a workspace + api_response = workspace_memberships_api_instance.get_workspace_memberships_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling WorkspaceMembershipsApi->get_workspace_memberships_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **user** | **str**| A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. | [optional] + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/WorkspaceMembershipsApi.yaml b/docs/WorkspaceMembershipsApi.yaml new file mode 100644 index 00000000..fc0945ac --- /dev/null +++ b/docs/WorkspaceMembershipsApi.yaml @@ -0,0 +1,74 @@ +WorkspaceMembershipsApi: + get_workspace_membership: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspace_memberships_api_instance = asana.WorkspaceMembershipsApi(api_client) + workspace_membership_gid = "12345" # str | + opts = { + 'opt_fields': "created_at,is_active,is_admin,is_guest,user,user.name,user_task_list,user_task_list.name,user_task_list.owner,user_task_list.workspace,vacation_dates,vacation_dates.end_on,vacation_dates.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a workspace membership + api_response = workspace_memberships_api_instance.get_workspace_membership(workspace_membership_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WorkspaceMembershipsApi->get_workspace_membership: %s\n" % e) + get_workspace_memberships_for_user: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspace_memberships_api_instance = asana.WorkspaceMembershipsApi(api_client) + user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "created_at,is_active,is_admin,is_guest,offset,path,uri,user,user.name,user_task_list,user_task_list.name,user_task_list.owner,user_task_list.workspace,vacation_dates,vacation_dates.end_on,vacation_dates.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get workspace memberships for a user + api_response = workspace_memberships_api_instance.get_workspace_memberships_for_user(user_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling WorkspaceMembershipsApi->get_workspace_memberships_for_user: %s\n" % e) + get_workspace_memberships_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspace_memberships_api_instance = asana.WorkspaceMembershipsApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'user': "me", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "created_at,is_active,is_admin,is_guest,offset,path,uri,user,user.name,user_task_list,user_task_list.name,user_task_list.owner,user_task_list.workspace,vacation_dates,vacation_dates.end_on,vacation_dates.start_on,workspace,workspace.name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get the workspace memberships for a workspace + api_response = workspace_memberships_api_instance.get_workspace_memberships_for_workspace(workspace_gid, opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling WorkspaceMembershipsApi->get_workspace_memberships_for_workspace: %s\n" % e) diff --git a/docs/WorkspacesApi.md b/docs/WorkspacesApi.md new file mode 100644 index 00000000..9644d845 --- /dev/null +++ b/docs/WorkspacesApi.md @@ -0,0 +1,273 @@ +# asana.WorkspacesApi + +All URIs are relative to *https://app.asana.com/api/1.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_user_for_workspace**](WorkspacesApi.md#add_user_for_workspace) | **POST** /workspaces/{workspace_gid}/addUser | Add a user to a workspace or organization +[**get_workspace**](WorkspacesApi.md#get_workspace) | **GET** /workspaces/{workspace_gid} | Get a workspace +[**get_workspaces**](WorkspacesApi.md#get_workspaces) | **GET** /workspaces | Get multiple workspaces +[**remove_user_for_workspace**](WorkspacesApi.md#remove_user_for_workspace) | **POST** /workspaces/{workspace_gid}/removeUser | Remove a user from a workspace or organization +[**update_workspace**](WorkspacesApi.md#update_workspace) | **PUT** /workspaces/{workspace_gid} | Update a workspace + +# **add_user_for_workspace** + +Add a user to a workspace or organization + +Add a user to a workspace or organization. The user can be referenced by their globally unique user ID or their email address. Returns the full user record for the invited user. + +([more information](https://developers.asana.com/reference/adduserforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspaces_api_instance = asana.WorkspacesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to add to the workspace. +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Add a user to a workspace or organization + api_response = workspaces_api_instance.add_user_for_workspace(body, workspace_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WorkspacesApi->add_user_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The user to add to the workspace. | + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_workspace** + +Get a workspace + +Returns the full workspace record for a single workspace. + +([more information](https://developers.asana.com/reference/getworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspaces_api_instance = asana.WorkspacesApi(api_client) +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'opt_fields': "email_domains,is_organization,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get a workspace + api_response = workspaces_api_instance.get_workspace(workspace_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WorkspacesApi->get_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **get_workspaces** + +Get multiple workspaces + +Returns the compact records for all workspaces visible to the authorized user. + +([more information](https://developers.asana.com/reference/getworkspaces)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspaces_api_instance = asana.WorkspacesApi(api_client) +opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "email_domains,is_organization,name,offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Get multiple workspaces + api_response = workspaces_api_instance.get_workspaces(opts) + for data in api_response: + pprint(data) +except ApiException as e: + print("Exception when calling WorkspacesApi->get_workspaces: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] + **offset** | **str**| Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' | [optional] + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +generator + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **remove_user_for_workspace** + +Remove a user from a workspace or organization + +Remove a user from a workspace or organization. The user making this call must be an admin in the workspace. The user can be referenced by their globally unique user ID or their email address. Returns an empty data record. + +([more information](https://developers.asana.com/reference/removeuserforworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspaces_api_instance = asana.WorkspacesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to remove from the workspace. +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + + +try: + # Remove a user from a workspace or organization + api_response = workspaces_api_instance.remove_user_for_workspace(body, workspace_gid) + pprint(api_response) +except ApiException as e: + print("Exception when calling WorkspacesApi->remove_user_for_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The user to remove from the workspace. | + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +# **update_workspace** + +Update a workspace + +A specific, existing workspace can be updated by making a PUT request on the URL for that workspace. Only the fields provided in the data block will be updated; any unspecified fields will remain unchanged. Currently the only field that can be modified for a workspace is its name. Returns the complete, updated workspace record. + +([more information](https://developers.asana.com/reference/updateworkspace)) + +### Example +```python +import asana +from asana.rest import ApiException +from pprint import pprint + +configuration = asana.Configuration() +configuration.access_token = '' +api_client = asana.ApiClient(configuration) + +# create an instance of the API class +workspaces_api_instance = asana.WorkspacesApi(api_client) +body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The workspace object with all updated properties. +workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. +opts = { + 'opt_fields': "email_domains,is_organization,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. +} + +try: + # Update a workspace + api_response = workspaces_api_instance.update_workspace(body, workspace_gid, opts) + pprint(api_response) +except ApiException as e: + print("Exception when calling WorkspacesApi->update_workspace: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Dict**| The workspace object with all updated properties. | + **workspace_gid** | **str**| Globally unique identifier for the workspace or organization. | + **opt_fields** | **Dict**| This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. | [optional] + +### Return type + +dict + +### HTTP request headers + + - **Content-Type**: application/json; charset=UTF-8 + - **Accept**: application/json; charset=UTF-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/WorkspacesApi.yaml b/docs/WorkspacesApi.yaml new file mode 100644 index 00000000..b287f71f --- /dev/null +++ b/docs/WorkspacesApi.yaml @@ -0,0 +1,114 @@ +WorkspacesApi: + add_user_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspaces_api_instance = asana.WorkspacesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to add to the workspace. + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'opt_fields': "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Add a user to a workspace or organization + api_response = workspaces_api_instance.add_user_for_workspace(body, workspace_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WorkspacesApi->add_user_for_workspace: %s\n" % e) + get_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspaces_api_instance = asana.WorkspacesApi(api_client) + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'opt_fields': "email_domains,is_organization,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get a workspace + api_response = workspaces_api_instance.get_workspace(workspace_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WorkspacesApi->get_workspace: %s\n" % e) + get_workspaces: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspaces_api_instance = asana.WorkspacesApi(api_client) + opts = { + 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100. + 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.' + 'opt_fields': "email_domains,is_organization,name,offset,path,uri" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Get multiple workspaces + api_response = workspaces_api_instance.get_workspaces(opts) + for data in api_response: + pprint(data) + except ApiException as e: + print("Exception when calling WorkspacesApi->get_workspaces: %s\n" % e) + remove_user_for_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspaces_api_instance = asana.WorkspacesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The user to remove from the workspace. + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + + + try: + # Remove a user from a workspace or organization + api_response = workspaces_api_instance.remove_user_for_workspace(body, workspace_gid) + pprint(api_response) + except ApiException as e: + print("Exception when calling WorkspacesApi->remove_user_for_workspace: %s\n" % e) + update_workspace: |- + import asana + from asana.rest import ApiException + from pprint import pprint + + configuration = asana.Configuration() + configuration.access_token = '' + api_client = asana.ApiClient(configuration) + + # create an instance of the API class + workspaces_api_instance = asana.WorkspacesApi(api_client) + body = {"data": {"param1": "value1", "param2": "value2",}} # dict | The workspace object with all updated properties. + workspace_gid = "12345" # str | Globally unique identifier for the workspace or organization. + opts = { + 'opt_fields': "email_domains,is_organization,name" # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. + } + + try: + # Update a workspace + api_response = workspaces_api_instance.update_workspace(body, workspace_gid, opts) + pprint(api_response) + except ApiException as e: + print("Exception when calling WorkspacesApi->update_workspace: %s\n" % e) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..bafdc075 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +certifi >= 14.05.14 +six >= 1.10 +python_dateutil >= 2.5.3 +setuptools >= 21.0.0 +urllib3 >= 1.15.1 diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..5ac1cbb1 --- /dev/null +++ b/setup.py @@ -0,0 +1,48 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import os +from setuptools import setup, find_packages # noqa: H301 + +NAME = "asana" +VERSION = "5.0.0" +with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: + LONG_DESCRIPTION = readme.read() +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = [ + "certifi>=2017.4.17", + "python-dateutil>=2.1", + "six>=1.10", + "urllib3>=1.23" +] + + +setup( + name=NAME, + version=VERSION, + description="Asana", + long_description=LONG_DESCRIPTION, + long_description_content_type='text/markdown', + author='Asana, Inc', + url="http://github.com/asana/python-asana", + keywords=["asana", "Asana"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + license='MIT', +) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..2702246c --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,5 @@ +coverage>=4.0.3 +nose>=1.3.7 +pluggy>=0.3.1 +py>=1.4.31 +randomize>=0.13 diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 00000000..576f56f8 --- /dev/null +++ b/test/__init__.py @@ -0,0 +1 @@ +# coding: utf-8 \ No newline at end of file diff --git a/test/test_attachments_api.py b/test/test_attachments_api.py new file mode 100644 index 00000000..1d8c7899 --- /dev/null +++ b/test/test_attachments_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.attachments_api import AttachmentsApi # noqa: E501 +from asana.rest import ApiException + + +class TestAttachmentsApi(unittest.TestCase): + """AttachmentsApi unit test stubs""" + + def setUp(self): + self.api = AttachmentsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_attachment_for_object(self): + """Test case for create_attachment_for_object + + Upload an attachment # noqa: E501 + """ + pass + + def test_delete_attachment(self): + """Test case for delete_attachment + + Delete an attachment # noqa: E501 + """ + pass + + def test_get_attachment(self): + """Test case for get_attachment + + Get an attachment # noqa: E501 + """ + pass + + def test_get_attachments_for_object(self): + """Test case for get_attachments_for_object + + Get attachments from an object # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_audit_log_api_api.py b/test/test_audit_log_api_api.py new file mode 100644 index 00000000..5c0fe1d5 --- /dev/null +++ b/test/test_audit_log_api_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.audit_log_api_api import AuditLogAPIApi # noqa: E501 +from asana.rest import ApiException + + +class TestAuditLogAPIApi(unittest.TestCase): + """AuditLogAPIApi unit test stubs""" + + def setUp(self): + self.api = AuditLogAPIApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_audit_log_events(self): + """Test case for get_audit_log_events + + Get audit log events # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_batch_api_api.py b/test/test_batch_api_api.py new file mode 100644 index 00000000..bffbc5a3 --- /dev/null +++ b/test/test_batch_api_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.batch_api_api import BatchAPIApi # noqa: E501 +from asana.rest import ApiException + + +class TestBatchAPIApi(unittest.TestCase): + """BatchAPIApi unit test stubs""" + + def setUp(self): + self.api = BatchAPIApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_batch_request(self): + """Test case for create_batch_request + + Submit parallel requests # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_custom_field_settings_api.py b/test/test_custom_field_settings_api.py new file mode 100644 index 00000000..c82c55fc --- /dev/null +++ b/test/test_custom_field_settings_api.py @@ -0,0 +1,47 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.custom_field_settings_api import CustomFieldSettingsApi # noqa: E501 +from asana.rest import ApiException + + +class TestCustomFieldSettingsApi(unittest.TestCase): + """CustomFieldSettingsApi unit test stubs""" + + def setUp(self): + self.api = CustomFieldSettingsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_custom_field_settings_for_portfolio(self): + """Test case for get_custom_field_settings_for_portfolio + + Get a portfolio's custom fields # noqa: E501 + """ + pass + + def test_get_custom_field_settings_for_project(self): + """Test case for get_custom_field_settings_for_project + + Get a project's custom fields # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_custom_fields_api.py b/test/test_custom_fields_api.py new file mode 100644 index 00000000..473420bc --- /dev/null +++ b/test/test_custom_fields_api.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.custom_fields_api import CustomFieldsApi # noqa: E501 +from asana.rest import ApiException + + +class TestCustomFieldsApi(unittest.TestCase): + """CustomFieldsApi unit test stubs""" + + def setUp(self): + self.api = CustomFieldsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_custom_field(self): + """Test case for create_custom_field + + Create a custom field # noqa: E501 + """ + pass + + def test_create_enum_option_for_custom_field(self): + """Test case for create_enum_option_for_custom_field + + Create an enum option # noqa: E501 + """ + pass + + def test_delete_custom_field(self): + """Test case for delete_custom_field + + Delete a custom field # noqa: E501 + """ + pass + + def test_get_custom_field(self): + """Test case for get_custom_field + + Get a custom field # noqa: E501 + """ + pass + + def test_get_custom_fields_for_workspace(self): + """Test case for get_custom_fields_for_workspace + + Get a workspace's custom fields # noqa: E501 + """ + pass + + def test_insert_enum_option_for_custom_field(self): + """Test case for insert_enum_option_for_custom_field + + Reorder a custom field's enum # noqa: E501 + """ + pass + + def test_update_custom_field(self): + """Test case for update_custom_field + + Update a custom field # noqa: E501 + """ + pass + + def test_update_enum_option(self): + """Test case for update_enum_option + + Update an enum option # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_events_api.py b/test/test_events_api.py new file mode 100644 index 00000000..5fbad0e8 --- /dev/null +++ b/test/test_events_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.events_api import EventsApi # noqa: E501 +from asana.rest import ApiException + + +class TestEventsApi(unittest.TestCase): + """EventsApi unit test stubs""" + + def setUp(self): + self.api = EventsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_events(self): + """Test case for get_events + + Get events on a resource # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_goal_relationships_api.py b/test/test_goal_relationships_api.py new file mode 100644 index 00000000..456e02f1 --- /dev/null +++ b/test/test_goal_relationships_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.goal_relationships_api import GoalRelationshipsApi # noqa: E501 +from asana.rest import ApiException + + +class TestGoalRelationshipsApi(unittest.TestCase): + """GoalRelationshipsApi unit test stubs""" + + def setUp(self): + self.api = GoalRelationshipsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_supporting_relationship(self): + """Test case for add_supporting_relationship + + Add a supporting goal relationship # noqa: E501 + """ + pass + + def test_get_goal_relationship(self): + """Test case for get_goal_relationship + + Get a goal relationship # noqa: E501 + """ + pass + + def test_get_goal_relationships(self): + """Test case for get_goal_relationships + + Get goal relationships # noqa: E501 + """ + pass + + def test_remove_supporting_relationship(self): + """Test case for remove_supporting_relationship + + Removes a supporting goal relationship # noqa: E501 + """ + pass + + def test_update_goal_relationship(self): + """Test case for update_goal_relationship + + Update a goal relationship # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_goals_api.py b/test/test_goals_api.py new file mode 100644 index 00000000..746e7324 --- /dev/null +++ b/test/test_goals_api.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.goals_api import GoalsApi # noqa: E501 +from asana.rest import ApiException + + +class TestGoalsApi(unittest.TestCase): + """GoalsApi unit test stubs""" + + def setUp(self): + self.api = GoalsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_followers(self): + """Test case for add_followers + + Add a collaborator to a goal # noqa: E501 + """ + pass + + def test_create_goal(self): + """Test case for create_goal + + Create a goal # noqa: E501 + """ + pass + + def test_create_goal_metric(self): + """Test case for create_goal_metric + + Create a goal metric # noqa: E501 + """ + pass + + def test_delete_goal(self): + """Test case for delete_goal + + Delete a goal # noqa: E501 + """ + pass + + def test_get_goal(self): + """Test case for get_goal + + Get a goal # noqa: E501 + """ + pass + + def test_get_goals(self): + """Test case for get_goals + + Get goals # noqa: E501 + """ + pass + + def test_get_parent_goals_for_goal(self): + """Test case for get_parent_goals_for_goal + + Get parent goals from a goal # noqa: E501 + """ + pass + + def test_remove_followers(self): + """Test case for remove_followers + + Remove a collaborator from a goal # noqa: E501 + """ + pass + + def test_update_goal(self): + """Test case for update_goal + + Update a goal # noqa: E501 + """ + pass + + def test_update_goal_metric(self): + """Test case for update_goal_metric + + Update a goal metric # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_jobs_api.py b/test/test_jobs_api.py new file mode 100644 index 00000000..88fe30f7 --- /dev/null +++ b/test/test_jobs_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.jobs_api import JobsApi # noqa: E501 +from asana.rest import ApiException + + +class TestJobsApi(unittest.TestCase): + """JobsApi unit test stubs""" + + def setUp(self): + self.api = JobsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_job(self): + """Test case for get_job + + Get a job by id # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_memberships_api.py b/test/test_memberships_api.py new file mode 100644 index 00000000..87c883f5 --- /dev/null +++ b/test/test_memberships_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.memberships_api import MembershipsApi # noqa: E501 +from asana.rest import ApiException + + +class TestMembershipsApi(unittest.TestCase): + """MembershipsApi unit test stubs""" + + def setUp(self): + self.api = MembershipsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_membership(self): + """Test case for create_membership + + Create a membership # noqa: E501 + """ + pass + + def test_delete_membership(self): + """Test case for delete_membership + + Delete a membership # noqa: E501 + """ + pass + + def test_get_membership(self): + """Test case for get_membership + + Get a membership # noqa: E501 + """ + pass + + def test_get_memberships(self): + """Test case for get_memberships + + Get multiple memberships # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_organization_exports_api.py b/test/test_organization_exports_api.py new file mode 100644 index 00000000..3450ffbd --- /dev/null +++ b/test/test_organization_exports_api.py @@ -0,0 +1,47 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.organization_exports_api import OrganizationExportsApi # noqa: E501 +from asana.rest import ApiException + + +class TestOrganizationExportsApi(unittest.TestCase): + """OrganizationExportsApi unit test stubs""" + + def setUp(self): + self.api = OrganizationExportsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_organization_export(self): + """Test case for create_organization_export + + Create an organization export request # noqa: E501 + """ + pass + + def test_get_organization_export(self): + """Test case for get_organization_export + + Get details on an org export request # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_portfolio_memberships_api.py b/test/test_portfolio_memberships_api.py new file mode 100644 index 00000000..329b11f0 --- /dev/null +++ b/test/test_portfolio_memberships_api.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.portfolio_memberships_api import PortfolioMembershipsApi # noqa: E501 +from asana.rest import ApiException + + +class TestPortfolioMembershipsApi(unittest.TestCase): + """PortfolioMembershipsApi unit test stubs""" + + def setUp(self): + self.api = PortfolioMembershipsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_portfolio_membership(self): + """Test case for get_portfolio_membership + + Get a portfolio membership # noqa: E501 + """ + pass + + def test_get_portfolio_memberships(self): + """Test case for get_portfolio_memberships + + Get multiple portfolio memberships # noqa: E501 + """ + pass + + def test_get_portfolio_memberships_for_portfolio(self): + """Test case for get_portfolio_memberships_for_portfolio + + Get memberships from a portfolio # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_portfolios_api.py b/test/test_portfolios_api.py new file mode 100644 index 00000000..36b434f3 --- /dev/null +++ b/test/test_portfolios_api.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.portfolios_api import PortfoliosApi # noqa: E501 +from asana.rest import ApiException + + +class TestPortfoliosApi(unittest.TestCase): + """PortfoliosApi unit test stubs""" + + def setUp(self): + self.api = PortfoliosApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_custom_field_setting_for_portfolio(self): + """Test case for add_custom_field_setting_for_portfolio + + Add a custom field to a portfolio # noqa: E501 + """ + pass + + def test_add_item_for_portfolio(self): + """Test case for add_item_for_portfolio + + Add a portfolio item # noqa: E501 + """ + pass + + def test_add_members_for_portfolio(self): + """Test case for add_members_for_portfolio + + Add users to a portfolio # noqa: E501 + """ + pass + + def test_create_portfolio(self): + """Test case for create_portfolio + + Create a portfolio # noqa: E501 + """ + pass + + def test_delete_portfolio(self): + """Test case for delete_portfolio + + Delete a portfolio # noqa: E501 + """ + pass + + def test_get_items_for_portfolio(self): + """Test case for get_items_for_portfolio + + Get portfolio items # noqa: E501 + """ + pass + + def test_get_portfolio(self): + """Test case for get_portfolio + + Get a portfolio # noqa: E501 + """ + pass + + def test_get_portfolios(self): + """Test case for get_portfolios + + Get multiple portfolios # noqa: E501 + """ + pass + + def test_remove_custom_field_setting_for_portfolio(self): + """Test case for remove_custom_field_setting_for_portfolio + + Remove a custom field from a portfolio # noqa: E501 + """ + pass + + def test_remove_item_for_portfolio(self): + """Test case for remove_item_for_portfolio + + Remove a portfolio item # noqa: E501 + """ + pass + + def test_remove_members_for_portfolio(self): + """Test case for remove_members_for_portfolio + + Remove users from a portfolio # noqa: E501 + """ + pass + + def test_update_portfolio(self): + """Test case for update_portfolio + + Update a portfolio # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project_briefs_api.py b/test/test_project_briefs_api.py new file mode 100644 index 00000000..f2c81108 --- /dev/null +++ b/test/test_project_briefs_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.project_briefs_api import ProjectBriefsApi # noqa: E501 +from asana.rest import ApiException + + +class TestProjectBriefsApi(unittest.TestCase): + """ProjectBriefsApi unit test stubs""" + + def setUp(self): + self.api = ProjectBriefsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_project_brief(self): + """Test case for create_project_brief + + Create a project brief # noqa: E501 + """ + pass + + def test_delete_project_brief(self): + """Test case for delete_project_brief + + Delete a project brief # noqa: E501 + """ + pass + + def test_get_project_brief(self): + """Test case for get_project_brief + + Get a project brief # noqa: E501 + """ + pass + + def test_update_project_brief(self): + """Test case for update_project_brief + + Update a project brief # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project_memberships_api.py b/test/test_project_memberships_api.py new file mode 100644 index 00000000..58da9cea --- /dev/null +++ b/test/test_project_memberships_api.py @@ -0,0 +1,47 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.project_memberships_api import ProjectMembershipsApi # noqa: E501 +from asana.rest import ApiException + + +class TestProjectMembershipsApi(unittest.TestCase): + """ProjectMembershipsApi unit test stubs""" + + def setUp(self): + self.api = ProjectMembershipsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_project_membership(self): + """Test case for get_project_membership + + Get a project membership # noqa: E501 + """ + pass + + def test_get_project_memberships_for_project(self): + """Test case for get_project_memberships_for_project + + Get memberships from a project # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project_statuses_api.py b/test/test_project_statuses_api.py new file mode 100644 index 00000000..ca1867f9 --- /dev/null +++ b/test/test_project_statuses_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.project_statuses_api import ProjectStatusesApi # noqa: E501 +from asana.rest import ApiException + + +class TestProjectStatusesApi(unittest.TestCase): + """ProjectStatusesApi unit test stubs""" + + def setUp(self): + self.api = ProjectStatusesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_project_status_for_project(self): + """Test case for create_project_status_for_project + + Create a project status # noqa: E501 + """ + pass + + def test_delete_project_status(self): + """Test case for delete_project_status + + Delete a project status # noqa: E501 + """ + pass + + def test_get_project_status(self): + """Test case for get_project_status + + Get a project status # noqa: E501 + """ + pass + + def test_get_project_statuses_for_project(self): + """Test case for get_project_statuses_for_project + + Get statuses from a project # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project_templates_api.py b/test/test_project_templates_api.py new file mode 100644 index 00000000..bcc9bad9 --- /dev/null +++ b/test/test_project_templates_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.project_templates_api import ProjectTemplatesApi # noqa: E501 +from asana.rest import ApiException + + +class TestProjectTemplatesApi(unittest.TestCase): + """ProjectTemplatesApi unit test stubs""" + + def setUp(self): + self.api = ProjectTemplatesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_delete_project_template(self): + """Test case for delete_project_template + + Delete a project template # noqa: E501 + """ + pass + + def test_get_project_template(self): + """Test case for get_project_template + + Get a project template # noqa: E501 + """ + pass + + def test_get_project_templates(self): + """Test case for get_project_templates + + Get multiple project templates # noqa: E501 + """ + pass + + def test_get_project_templates_for_team(self): + """Test case for get_project_templates_for_team + + Get a team's project templates # noqa: E501 + """ + pass + + def test_instantiate_project(self): + """Test case for instantiate_project + + Instantiate a project from a project template # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_projects_api.py b/test/test_projects_api.py new file mode 100644 index 00000000..ad6b8ab0 --- /dev/null +++ b/test/test_projects_api.py @@ -0,0 +1,166 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.projects_api import ProjectsApi # noqa: E501 +from asana.rest import ApiException + + +class TestProjectsApi(unittest.TestCase): + """ProjectsApi unit test stubs""" + + def setUp(self): + self.api = ProjectsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_custom_field_setting_for_project(self): + """Test case for add_custom_field_setting_for_project + + Add a custom field to a project # noqa: E501 + """ + pass + + def test_add_followers_for_project(self): + """Test case for add_followers_for_project + + Add followers to a project # noqa: E501 + """ + pass + + def test_add_members_for_project(self): + """Test case for add_members_for_project + + Add users to a project # noqa: E501 + """ + pass + + def test_create_project(self): + """Test case for create_project + + Create a project # noqa: E501 + """ + pass + + def test_create_project_for_team(self): + """Test case for create_project_for_team + + Create a project in a team # noqa: E501 + """ + pass + + def test_create_project_for_workspace(self): + """Test case for create_project_for_workspace + + Create a project in a workspace # noqa: E501 + """ + pass + + def test_delete_project(self): + """Test case for delete_project + + Delete a project # noqa: E501 + """ + pass + + def test_duplicate_project(self): + """Test case for duplicate_project + + Duplicate a project # noqa: E501 + """ + pass + + def test_get_project(self): + """Test case for get_project + + Get a project # noqa: E501 + """ + pass + + def test_get_projects(self): + """Test case for get_projects + + Get multiple projects # noqa: E501 + """ + pass + + def test_get_projects_for_task(self): + """Test case for get_projects_for_task + + Get projects a task is in # noqa: E501 + """ + pass + + def test_get_projects_for_team(self): + """Test case for get_projects_for_team + + Get a team's projects # noqa: E501 + """ + pass + + def test_get_projects_for_workspace(self): + """Test case for get_projects_for_workspace + + Get all projects in a workspace # noqa: E501 + """ + pass + + def test_get_task_counts_for_project(self): + """Test case for get_task_counts_for_project + + Get task count of a project # noqa: E501 + """ + pass + + def test_project_save_as_template(self): + """Test case for project_save_as_template + + Create a project template from a project # noqa: E501 + """ + pass + + def test_remove_custom_field_setting_for_project(self): + """Test case for remove_custom_field_setting_for_project + + Remove a custom field from a project # noqa: E501 + """ + pass + + def test_remove_followers_for_project(self): + """Test case for remove_followers_for_project + + Remove followers from a project # noqa: E501 + """ + pass + + def test_remove_members_for_project(self): + """Test case for remove_members_for_project + + Remove users from a project # noqa: E501 + """ + pass + + def test_update_project(self): + """Test case for update_project + + Update a project # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_rules_api.py b/test/test_rules_api.py new file mode 100644 index 00000000..d98bb830 --- /dev/null +++ b/test/test_rules_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.rules_api import RulesApi # noqa: E501 +from asana.rest import ApiException + + +class TestRulesApi(unittest.TestCase): + """RulesApi unit test stubs""" + + def setUp(self): + self.api = RulesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_trigger_rule(self): + """Test case for trigger_rule + + Trigger a rule # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_sections_api.py b/test/test_sections_api.py new file mode 100644 index 00000000..8fac50ae --- /dev/null +++ b/test/test_sections_api.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.sections_api import SectionsApi # noqa: E501 +from asana.rest import ApiException + + +class TestSectionsApi(unittest.TestCase): + """SectionsApi unit test stubs""" + + def setUp(self): + self.api = SectionsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_task_for_section(self): + """Test case for add_task_for_section + + Add task to section # noqa: E501 + """ + pass + + def test_create_section_for_project(self): + """Test case for create_section_for_project + + Create a section in a project # noqa: E501 + """ + pass + + def test_delete_section(self): + """Test case for delete_section + + Delete a section # noqa: E501 + """ + pass + + def test_get_section(self): + """Test case for get_section + + Get a section # noqa: E501 + """ + pass + + def test_get_sections_for_project(self): + """Test case for get_sections_for_project + + Get sections in a project # noqa: E501 + """ + pass + + def test_insert_section_for_project(self): + """Test case for insert_section_for_project + + Move or Insert sections # noqa: E501 + """ + pass + + def test_update_section(self): + """Test case for update_section + + Update a section # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_status_updates_api.py b/test/test_status_updates_api.py new file mode 100644 index 00000000..d54b2136 --- /dev/null +++ b/test/test_status_updates_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.status_updates_api import StatusUpdatesApi # noqa: E501 +from asana.rest import ApiException + + +class TestStatusUpdatesApi(unittest.TestCase): + """StatusUpdatesApi unit test stubs""" + + def setUp(self): + self.api = StatusUpdatesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_status_for_object(self): + """Test case for create_status_for_object + + Create a status update # noqa: E501 + """ + pass + + def test_delete_status(self): + """Test case for delete_status + + Delete a status update # noqa: E501 + """ + pass + + def test_get_status(self): + """Test case for get_status + + Get a status update # noqa: E501 + """ + pass + + def test_get_statuses_for_object(self): + """Test case for get_statuses_for_object + + Get status updates from an object # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_stories_api.py b/test/test_stories_api.py new file mode 100644 index 00000000..d52d2b67 --- /dev/null +++ b/test/test_stories_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.stories_api import StoriesApi # noqa: E501 +from asana.rest import ApiException + + +class TestStoriesApi(unittest.TestCase): + """StoriesApi unit test stubs""" + + def setUp(self): + self.api = StoriesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_story_for_task(self): + """Test case for create_story_for_task + + Create a story on a task # noqa: E501 + """ + pass + + def test_delete_story(self): + """Test case for delete_story + + Delete a story # noqa: E501 + """ + pass + + def test_get_stories_for_task(self): + """Test case for get_stories_for_task + + Get stories from a task # noqa: E501 + """ + pass + + def test_get_story(self): + """Test case for get_story + + Get a story # noqa: E501 + """ + pass + + def test_update_story(self): + """Test case for update_story + + Update a story # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_tags_api.py b/test/test_tags_api.py new file mode 100644 index 00000000..03235037 --- /dev/null +++ b/test/test_tags_api.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.tags_api import TagsApi # noqa: E501 +from asana.rest import ApiException + + +class TestTagsApi(unittest.TestCase): + """TagsApi unit test stubs""" + + def setUp(self): + self.api = TagsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_tag(self): + """Test case for create_tag + + Create a tag # noqa: E501 + """ + pass + + def test_create_tag_for_workspace(self): + """Test case for create_tag_for_workspace + + Create a tag in a workspace # noqa: E501 + """ + pass + + def test_delete_tag(self): + """Test case for delete_tag + + Delete a tag # noqa: E501 + """ + pass + + def test_get_tag(self): + """Test case for get_tag + + Get a tag # noqa: E501 + """ + pass + + def test_get_tags(self): + """Test case for get_tags + + Get multiple tags # noqa: E501 + """ + pass + + def test_get_tags_for_task(self): + """Test case for get_tags_for_task + + Get a task's tags # noqa: E501 + """ + pass + + def test_get_tags_for_workspace(self): + """Test case for get_tags_for_workspace + + Get tags in a workspace # noqa: E501 + """ + pass + + def test_update_tag(self): + """Test case for update_tag + + Update a tag # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_task_templates_api.py b/test/test_task_templates_api.py new file mode 100644 index 00000000..5bf08710 --- /dev/null +++ b/test/test_task_templates_api.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.task_templates_api import TaskTemplatesApi # noqa: E501 +from asana.rest import ApiException + + +class TestTaskTemplatesApi(unittest.TestCase): + """TaskTemplatesApi unit test stubs""" + + def setUp(self): + self.api = TaskTemplatesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_task_template(self): + """Test case for get_task_template + + Get a task template # noqa: E501 + """ + pass + + def test_get_task_templates(self): + """Test case for get_task_templates + + Get multiple task templates # noqa: E501 + """ + pass + + def test_instantiate_task(self): + """Test case for instantiate_task + + Instantiate a task from a task template # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_tasks_api.py b/test/test_tasks_api.py new file mode 100644 index 00000000..a66ced7e --- /dev/null +++ b/test/test_tasks_api.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.tasks_api import TasksApi # noqa: E501 +from asana.rest import ApiException + + +class TestTasksApi(unittest.TestCase): + """TasksApi unit test stubs""" + + def setUp(self): + self.api = TasksApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_dependencies_for_task(self): + """Test case for add_dependencies_for_task + + Set dependencies for a task # noqa: E501 + """ + pass + + def test_add_dependents_for_task(self): + """Test case for add_dependents_for_task + + Set dependents for a task # noqa: E501 + """ + pass + + def test_add_followers_for_task(self): + """Test case for add_followers_for_task + + Add followers to a task # noqa: E501 + """ + pass + + def test_add_project_for_task(self): + """Test case for add_project_for_task + + Add a project to a task # noqa: E501 + """ + pass + + def test_add_tag_for_task(self): + """Test case for add_tag_for_task + + Add a tag to a task # noqa: E501 + """ + pass + + def test_create_subtask_for_task(self): + """Test case for create_subtask_for_task + + Create a subtask # noqa: E501 + """ + pass + + def test_create_task(self): + """Test case for create_task + + Create a task # noqa: E501 + """ + pass + + def test_delete_task(self): + """Test case for delete_task + + Delete a task # noqa: E501 + """ + pass + + def test_duplicate_task(self): + """Test case for duplicate_task + + Duplicate a task # noqa: E501 + """ + pass + + def test_get_dependencies_for_task(self): + """Test case for get_dependencies_for_task + + Get dependencies from a task # noqa: E501 + """ + pass + + def test_get_dependents_for_task(self): + """Test case for get_dependents_for_task + + Get dependents from a task # noqa: E501 + """ + pass + + def test_get_subtasks_for_task(self): + """Test case for get_subtasks_for_task + + Get subtasks from a task # noqa: E501 + """ + pass + + def test_get_task(self): + """Test case for get_task + + Get a task # noqa: E501 + """ + pass + + def test_get_tasks(self): + """Test case for get_tasks + + Get multiple tasks # noqa: E501 + """ + pass + + def test_get_tasks_for_project(self): + """Test case for get_tasks_for_project + + Get tasks from a project # noqa: E501 + """ + pass + + def test_get_tasks_for_section(self): + """Test case for get_tasks_for_section + + Get tasks from a section # noqa: E501 + """ + pass + + def test_get_tasks_for_tag(self): + """Test case for get_tasks_for_tag + + Get tasks from a tag # noqa: E501 + """ + pass + + def test_get_tasks_for_user_task_list(self): + """Test case for get_tasks_for_user_task_list + + Get tasks from a user task list # noqa: E501 + """ + pass + + def test_remove_dependencies_for_task(self): + """Test case for remove_dependencies_for_task + + Unlink dependencies from a task # noqa: E501 + """ + pass + + def test_remove_dependents_for_task(self): + """Test case for remove_dependents_for_task + + Unlink dependents from a task # noqa: E501 + """ + pass + + def test_remove_follower_for_task(self): + """Test case for remove_follower_for_task + + Remove followers from a task # noqa: E501 + """ + pass + + def test_remove_project_for_task(self): + """Test case for remove_project_for_task + + Remove a project from a task # noqa: E501 + """ + pass + + def test_remove_tag_for_task(self): + """Test case for remove_tag_for_task + + Remove a tag from a task # noqa: E501 + """ + pass + + def test_search_tasks_for_workspace(self): + """Test case for search_tasks_for_workspace + + Search tasks in a workspace # noqa: E501 + """ + pass + + def test_set_parent_for_task(self): + """Test case for set_parent_for_task + + Set the parent of a task # noqa: E501 + """ + pass + + def test_update_task(self): + """Test case for update_task + + Update a task # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_team_memberships_api.py b/test/test_team_memberships_api.py new file mode 100644 index 00000000..6ed7e137 --- /dev/null +++ b/test/test_team_memberships_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.team_memberships_api import TeamMembershipsApi # noqa: E501 +from asana.rest import ApiException + + +class TestTeamMembershipsApi(unittest.TestCase): + """TeamMembershipsApi unit test stubs""" + + def setUp(self): + self.api = TeamMembershipsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_team_membership(self): + """Test case for get_team_membership + + Get a team membership # noqa: E501 + """ + pass + + def test_get_team_memberships(self): + """Test case for get_team_memberships + + Get team memberships # noqa: E501 + """ + pass + + def test_get_team_memberships_for_team(self): + """Test case for get_team_memberships_for_team + + Get memberships from a team # noqa: E501 + """ + pass + + def test_get_team_memberships_for_user(self): + """Test case for get_team_memberships_for_user + + Get memberships from a user # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_teams_api.py b/test/test_teams_api.py new file mode 100644 index 00000000..6b114d60 --- /dev/null +++ b/test/test_teams_api.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.teams_api import TeamsApi # noqa: E501 +from asana.rest import ApiException + + +class TestTeamsApi(unittest.TestCase): + """TeamsApi unit test stubs""" + + def setUp(self): + self.api = TeamsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_user_for_team(self): + """Test case for add_user_for_team + + Add a user to a team # noqa: E501 + """ + pass + + def test_create_team(self): + """Test case for create_team + + Create a team # noqa: E501 + """ + pass + + def test_get_team(self): + """Test case for get_team + + Get a team # noqa: E501 + """ + pass + + def test_get_teams_for_user(self): + """Test case for get_teams_for_user + + Get teams for a user # noqa: E501 + """ + pass + + def test_get_teams_for_workspace(self): + """Test case for get_teams_for_workspace + + Get teams in a workspace # noqa: E501 + """ + pass + + def test_remove_user_for_team(self): + """Test case for remove_user_for_team + + Remove a user from a team # noqa: E501 + """ + pass + + def test_update_team(self): + """Test case for update_team + + Update a team # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_time_periods_api.py b/test/test_time_periods_api.py new file mode 100644 index 00000000..1520f9d0 --- /dev/null +++ b/test/test_time_periods_api.py @@ -0,0 +1,47 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.time_periods_api import TimePeriodsApi # noqa: E501 +from asana.rest import ApiException + + +class TestTimePeriodsApi(unittest.TestCase): + """TimePeriodsApi unit test stubs""" + + def setUp(self): + self.api = TimePeriodsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_time_period(self): + """Test case for get_time_period + + Get a time period # noqa: E501 + """ + pass + + def test_get_time_periods(self): + """Test case for get_time_periods + + Get time periods # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_time_tracking_entries_api.py b/test/test_time_tracking_entries_api.py new file mode 100644 index 00000000..badc3f1b --- /dev/null +++ b/test/test_time_tracking_entries_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.time_tracking_entries_api import TimeTrackingEntriesApi # noqa: E501 +from asana.rest import ApiException + + +class TestTimeTrackingEntriesApi(unittest.TestCase): + """TimeTrackingEntriesApi unit test stubs""" + + def setUp(self): + self.api = TimeTrackingEntriesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_time_tracking_entry(self): + """Test case for create_time_tracking_entry + + Create a time tracking entry # noqa: E501 + """ + pass + + def test_delete_time_tracking_entry(self): + """Test case for delete_time_tracking_entry + + Delete a time tracking entry # noqa: E501 + """ + pass + + def test_get_time_tracking_entries_for_task(self): + """Test case for get_time_tracking_entries_for_task + + Get time tracking entries for a task # noqa: E501 + """ + pass + + def test_get_time_tracking_entry(self): + """Test case for get_time_tracking_entry + + Get a time tracking entry # noqa: E501 + """ + pass + + def test_update_time_tracking_entry(self): + """Test case for update_time_tracking_entry + + Update a time tracking entry # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_typeahead_api.py b/test/test_typeahead_api.py new file mode 100644 index 00000000..3d977d05 --- /dev/null +++ b/test/test_typeahead_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.typeahead_api import TypeaheadApi # noqa: E501 +from asana.rest import ApiException + + +class TestTypeaheadApi(unittest.TestCase): + """TypeaheadApi unit test stubs""" + + def setUp(self): + self.api = TypeaheadApi() # noqa: E501 + + def tearDown(self): + pass + + def test_typeahead_for_workspace(self): + """Test case for typeahead_for_workspace + + Get objects via typeahead # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_user_task_lists_api.py b/test/test_user_task_lists_api.py new file mode 100644 index 00000000..c7d53c27 --- /dev/null +++ b/test/test_user_task_lists_api.py @@ -0,0 +1,47 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.user_task_lists_api import UserTaskListsApi # noqa: E501 +from asana.rest import ApiException + + +class TestUserTaskListsApi(unittest.TestCase): + """UserTaskListsApi unit test stubs""" + + def setUp(self): + self.api = UserTaskListsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_user_task_list(self): + """Test case for get_user_task_list + + Get a user task list # noqa: E501 + """ + pass + + def test_get_user_task_list_for_user(self): + """Test case for get_user_task_list_for_user + + Get a user's task list # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_users_api.py b/test/test_users_api.py new file mode 100644 index 00000000..73258f4d --- /dev/null +++ b/test/test_users_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.users_api import UsersApi # noqa: E501 +from asana.rest import ApiException + + +class TestUsersApi(unittest.TestCase): + """UsersApi unit test stubs""" + + def setUp(self): + self.api = UsersApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_favorites_for_user(self): + """Test case for get_favorites_for_user + + Get a user's favorites # noqa: E501 + """ + pass + + def test_get_user(self): + """Test case for get_user + + Get a user # noqa: E501 + """ + pass + + def test_get_users(self): + """Test case for get_users + + Get multiple users # noqa: E501 + """ + pass + + def test_get_users_for_team(self): + """Test case for get_users_for_team + + Get users in a team # noqa: E501 + """ + pass + + def test_get_users_for_workspace(self): + """Test case for get_users_for_workspace + + Get users in a workspace or organization # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_webhooks_api.py b/test/test_webhooks_api.py new file mode 100644 index 00000000..9816f96a --- /dev/null +++ b/test/test_webhooks_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.webhooks_api import WebhooksApi # noqa: E501 +from asana.rest import ApiException + + +class TestWebhooksApi(unittest.TestCase): + """WebhooksApi unit test stubs""" + + def setUp(self): + self.api = WebhooksApi() # noqa: E501 + + def tearDown(self): + pass + + def test_create_webhook(self): + """Test case for create_webhook + + Establish a webhook # noqa: E501 + """ + pass + + def test_delete_webhook(self): + """Test case for delete_webhook + + Delete a webhook # noqa: E501 + """ + pass + + def test_get_webhook(self): + """Test case for get_webhook + + Get a webhook # noqa: E501 + """ + pass + + def test_get_webhooks(self): + """Test case for get_webhooks + + Get multiple webhooks # noqa: E501 + """ + pass + + def test_update_webhook(self): + """Test case for update_webhook + + Update a webhook # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_workspace_memberships_api.py b/test/test_workspace_memberships_api.py new file mode 100644 index 00000000..3d78d88b --- /dev/null +++ b/test/test_workspace_memberships_api.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.workspace_memberships_api import WorkspaceMembershipsApi # noqa: E501 +from asana.rest import ApiException + + +class TestWorkspaceMembershipsApi(unittest.TestCase): + """WorkspaceMembershipsApi unit test stubs""" + + def setUp(self): + self.api = WorkspaceMembershipsApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_workspace_membership(self): + """Test case for get_workspace_membership + + Get a workspace membership # noqa: E501 + """ + pass + + def test_get_workspace_memberships_for_user(self): + """Test case for get_workspace_memberships_for_user + + Get workspace memberships for a user # noqa: E501 + """ + pass + + def test_get_workspace_memberships_for_workspace(self): + """Test case for get_workspace_memberships_for_workspace + + Get the workspace memberships for a workspace # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_workspaces_api.py b/test/test_workspaces_api.py new file mode 100644 index 00000000..68447122 --- /dev/null +++ b/test/test_workspaces_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Asana + + This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml). # noqa: E501 + + OpenAPI spec version: 1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import unittest + +import asana +from asana.api.workspaces_api import WorkspacesApi # noqa: E501 +from asana.rest import ApiException + + +class TestWorkspacesApi(unittest.TestCase): + """WorkspacesApi unit test stubs""" + + def setUp(self): + self.api = WorkspacesApi() # noqa: E501 + + def tearDown(self): + pass + + def test_add_user_for_workspace(self): + """Test case for add_user_for_workspace + + Add a user to a workspace or organization # noqa: E501 + """ + pass + + def test_get_workspace(self): + """Test case for get_workspace + + Get a workspace # noqa: E501 + """ + pass + + def test_get_workspaces(self): + """Test case for get_workspaces + + Get multiple workspaces # noqa: E501 + """ + pass + + def test_remove_user_for_workspace(self): + """Test case for remove_user_for_workspace + + Remove a user from a workspace or organization # noqa: E501 + """ + pass + + def test_update_workspace(self): + """Test case for update_workspace + + Update a workspace # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..a310bec9 --- /dev/null +++ b/tox.ini @@ -0,0 +1,10 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + nosetests \ + []