diff --git a/.github/workflows/build-with-bal-test-native.yml b/.github/workflows/build-with-bal-test-native.yml index b889744..50a47cc 100644 --- a/.github/workflows/build-with-bal-test-native.yml +++ b/.github/workflows/build-with-bal-test-native.yml @@ -1,40 +1,42 @@ name: GraalVM Check -on: +on: schedule: - cron: '30 18 * * *' workflow_dispatch: jobs: - build: - runs-on: ubuntu-latest + build: + runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + steps: + - uses: actions/checkout@v2 - - name: Set up GraalVM - uses: graalvm/setup-graalvm@v1 - with: - version: 'latest' - java-version: '11' - components: 'native-image' - github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Check GraalVM installation - run: | - echo "GRAALVM_HOME: ${{ env.GRAALVM_HOME }}" - echo "JAVA_HOME: ${{ env.JAVA_HOME }}" - native-image --version - - - name: Set Up Ballerina - uses: ballerina-platform/setup-ballerina@v1.1.0 - with: - version: latest + - name: Set up GraalVM + uses: graalvm/setup-graalvm@v1 + with: + version: 'latest' + java-version: '11' + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Run Ballerina tests using the native executable - run: bal test --graalvm ./onenote - env: - REFRESH_URL: ${{ secrets.REFRESH_URL }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + - name: Check GraalVM installation + run: | + echo "GRAALVM_HOME: ${{ env.GRAALVM_HOME }}" + echo "JAVA_HOME: ${{ env.JAVA_HOME }}" + native-image --version + + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 + with: + version: latest + + - name: Run Ballerina tests using the native executable + working-directory: ./ballerina + run: bal test --graalvm + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + REFRESH_URL: ${{ secrets.REFRESH_URL }} + REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acfa19f..b3a279a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,46 +2,62 @@ name: CI on: push: - branches: - - '**' + branches-ignore: + - "automated/dependency_version_update" + - "automated/dependency_version_update_tmp" repository_dispatch: types: check_connector_for_breaking_changes jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Ballerina Build - uses: ballerina-platform/ballerina-action/@nightly - with: - args: - pack ./onenote - - name: Ballerina Test - uses: ballerina-platform/ballerina-action/@nightly - with: - args: - test --code-coverage ./onenote - env: - REFRESH_URL: ${{ secrets.REFRESH_URL }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - - # Read the ballerina test results - - name: Read Ballerina Test Results - id: test_results - run: | - content=`cat ./onenote/target/report/test_results.json` - content="${content//'%'/'%25'}" - content="${content//$'\n'/'%0A'}" - content="${content//$'\r'/'%0D'}" - echo "::set-output name=testResultsJson::$content" - - # Print the code coverage information - - name: Code Coverage - run: | - echo "Covered Code Lines : ${{fromJson(steps.test_results.outputs.testResultsJson).coveredLines}}" - echo "Total Code Lines : $(expr ${{fromJson(steps.test_results.outputs.testResultsJson).missedLines}} + ${{fromJson(steps.test_results.outputs.testResultsJson).coveredLines}})" - echo "Code Coverage Percentage : ${{fromJson(steps.test_results.outputs.testResultsJson).coveragePercentage}}" + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + # Setup Ballerina Environment + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 + with: + version: latest + + # Build Ballerina Project + - name: Ballerina Build + run: bal pack ./ballerina + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Build Module Examples + - name: Ballerina Examples Build + run: chmod +x ./examples/build.sh && ./examples/build.sh build + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Test Ballerina Project + - name: Ballerina Test + run: bal test ./ballerina --test-report --code-coverage --coverage-format=xml + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + REFRESH_URL: ${{ secrets.REFRESH_URL }} + REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + + # Send notification when build fails + - name: Alert notifier on failure + if: failure() && (github.event.action == 'check_connector_for_breaking_changes') + run: | + curl -X POST \ + 'https://api.github.com/repos/ballerina-platform/ballerina-release/dispatches' \ + --header 'Accept: application/vnd.github.v3+json' \ + --header 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \ + --data-raw '{ + "event_type": "notify-ballerinax-connector-build-failure", + "client_payload": { + "repoName": "module-ballerinax-microsoft.onenote", + "workflow": "CI" + } + }' diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index 51008f3..cacff0e 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -1,54 +1,58 @@ name: Daily build -# Controls when the action will run. -on: +on: schedule: - cron: '30 2 * * *' -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - # Build the ballerina project - - name: Ballerina Build - uses: ballerina-platform/ballerina-action/@nightly - with: - args: - pack ./onenote - - # Test the ballerina project - - name: Ballerina Test - uses: ballerina-platform/ballerina-action/@nightly - with: - args: - test --code-coverage ./onenote - env: - REFRESH_URL: ${{ secrets.REFRESH_URL }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - - # Read the ballerina test results - - name: Read Ballerina Test Results - id: test_results - run: | - content=`cat ./onenote/target/report/test_results.json` - content="${content//'%'/'%25'}" - content="${content//$'\n'/'%0A'}" - content="${content//$'\r'/'%0D'}" - echo "::set-output name=testResultsJson::$content" - - # Print the code coverage information - - name: Code Coverage - run: | - echo "Covered Code Lines : ${{fromJson(steps.test_results.outputs.testResultsJson).coveredLines}}" - echo "Total Code Lines : $(expr ${{fromJson(steps.test_results.outputs.testResultsJson).missedLines}} + ${{fromJson(steps.test_results.outputs.testResultsJson).coveredLines}})" - echo "Code Coverage Percentage : ${{fromJson(steps.test_results.outputs.testResultsJson).coveragePercentage}}" + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + # Setup Ballerina Environment + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 + with: + version: latest + + # Build Ballerina Project + - name: Ballerina Build + run: bal pack ./ballerina + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Build Module Examples + - name: Ballerina Examples Build + run: chmod +x ./examples/build.sh && ./examples/build.sh build + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Test Ballerina Project + - name: Ballerina Test + run: bal test ./ballerina --test-report --code-coverage --coverage-format=xml + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + REFRESH_URL: ${{ secrets.REFRESH_URL }} + REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + + # Send notification when build fails + - name: Notify failure + if: ${{ failure() }} + run: | + curl -X POST \ + 'https://api.github.com/repos/ballerina-platform/ballerina-release/dispatches' \ + -H 'Accept: application/vnd.github.v3+json' \ + -H 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \ + --data "{ + \"event_type\": \"notify-build-failure\", + \"client_payload\": { + \"repoName\": \"module-ballerinax-microsoft.onenote\" + } + }" diff --git a/.github/workflows/dev-stg-release.yml b/.github/workflows/dev-stg-release.yml index c0b81a7..c9bd8eb 100644 --- a/.github/workflows/dev-stg-release.yml +++ b/.github/workflows/dev-stg-release.yml @@ -7,39 +7,50 @@ on: description: Ballerina Central Environment type: choice options: - - STAGE - - DEV + - STAGE + - DEV required: true jobs: - release: - runs-on: ubuntu-latest - env: - BALLERINA_${{ github.event.inputs.bal_central_environment }}_CENTRAL: true - steps: - - uses: actions/checkout@v2 - - name: Ballerina Build - uses: ballerina-platform/ballerina-action/@2201.2.1 - with: - args: - pack ./onenote + release: + runs-on: ubuntu-latest + env: + BALLERINA_${{ github.event.inputs.bal_central_environment }}_CENTRAL: true + steps: + - uses: actions/checkout@v2 - - name: Push to Staging - uses: ballerina-platform/ballerina-action/@2201.2.1 - if: github.event.inputs.bal_central_environment == 'STAGE' - with: - args: - push - env: - WORKING_DIR: ./onenote - BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_STAGE_ACCESS_TOKEN }} + # Setup Ballerina Environment + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 + with: + version: 2201.2.1 - - name: Push to Dev - uses: ballerina-platform/ballerina-action/@2201.2.1 - if: github.event.inputs.bal_central_environment == 'DEV' - with: - args: - push - env: - WORKING_DIR: ./onenote - BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }} + # Build Ballerina Project + - name: Ballerina Build + run: bal pack ./ballerina + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Build Module Examples + - name: Ballerina Examples Build + run: chmod +x ./examples/build.sh && ./examples/build.sh build + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Push to Ballerina Staging Central + - name: Push to Staging + if: github.event.inputs.bal_central_environment == 'STAGE' + run: bal push + working-directory: ./ballerina + env: + BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_STAGE_ACCESS_TOKEN }} + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Push to Ballerina Dev Central + - name: Push to Dev + if: github.event.inputs.bal_central_environment == 'DEV' + run: bal push + working-directory: ./ballerina + env: + BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }} + JAVA_HOME: /usr/lib/jvm/default-jvm diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index f2d2c56..699f641 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,15 +1,42 @@ name: Pull Request -on: [pull_request] +on: [ pull_request ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Ballerina Build - uses: ballerina-platform/ballerina-action/@nightly + + # Setup Ballerina Environment + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 with: - args: - pack ./onenote - \ No newline at end of file + version: latest + + # Build Ballerina Project + - name: Ballerina Build + run: bal pack ./ballerina + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Build Module Examples + - name: Ballerina Examples Build + run: chmod +x ./examples/build.sh && ./examples/build.sh build + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Test Ballerina Project + - name: Ballerina Test + # tests will be skipped if the PR is from a forked repository (as the secrets are not available) + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} + run: bal test ./ballerina --test-report --code-coverage --coverage-format=xml + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + REFRESH_URL: ${{ secrets.REFRESH_URL }} + REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a0fb89..495f63a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,30 +1,37 @@ -name: Push to Ballerina Central +name: Deployment on: release: - types: [published] + types: [ published ] jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Ballerina Build - uses: ballerina-platform/ballerina-action/@2201.2.1 - with: - args: - pack ./onenote - env: - REFRESH_URL: ${{ secrets.REFRESH_URL }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - - name: Ballerina Push - uses: ballerina-platform/ballerina-action/@2201.2.1 - with: - args: - push - env: - WORKING_DIR: ./onenote - BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }} - \ No newline at end of file + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + # Setup Ballerina Environment + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 + with: + version: 2201.2.1 + + # Build Ballerina Project + - name: Ballerina Build + run: bal pack ./ballerina + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Build Module Examples + - name: Ballerina Examples Build + run: chmod +x ./examples/build.sh && ./examples/build.sh build + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Push to Ballerina Central + - name: Ballerina Push + run: bal push + working-directory: ./ballerina + env: + BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }} + JAVA_HOME: /usr/lib/jvm/default-jvm diff --git a/.gitignore b/.gitignore index 3ea5491..2796de3 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ .mtj.tmp/ # Package Files # +*.jar *.war *.nar *.ear diff --git a/README.md b/README.md index 44cea75..709bbdc 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ Ballerina Connector For Microsoft OneNote =================== [![Build Status](https://github.com/ballerina-platform/module-ballerinax-microsoft.onenote/workflows/CI/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-msgraph-onedrive/actions?query=workflow%3ACI) +[![codecov](https://codecov.io/gh/ballerina-platform/module-ballerinax-microsoft.onenote/branch/main/graph/badge.svg)](https://codecov.io/gh/ballerina-platform/module-ballerinax-microsoft.onenote) [![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/module-ballerinax-microsoft.onenote.svg)](https://github.com/ballerina-platform/module-ballerinax-microsoft.onenote/commits/main) [![GraalVM Check](https://github.com/ballerina-platform/module-ballerinax-microsoft.onenote/actions/workflows/build-with-bal-test-native.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-microsoft.onenote/actions/workflows/build-with-bal-test-native.yml) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) @@ -29,11 +30,11 @@ Execute the commands below to build from the source. * To build the package: ``` - bal pack ./onenote + bal build ./ballerina ``` * To test the package after build: ``` - bal test ./onenote + bal test ./ballerina ``` ## Contributing to Ballerina As an open source project, Ballerina welcomes contributions from the community. diff --git a/onenote/Ballerina.toml b/ballerina/Ballerina.toml similarity index 100% rename from onenote/Ballerina.toml rename to ballerina/Ballerina.toml diff --git a/onenote/Module.md b/ballerina/Module.md similarity index 96% rename from onenote/Module.md rename to ballerina/Module.md index 22c3463..617958e 100644 --- a/onenote/Module.md +++ b/ballerina/Module.md @@ -44,4 +44,4 @@ public function main() returns error? { } ``` -**[You can find a list of samples here](https://github.com/ballerina-platform/module-ballerinax-microsoft.onenote/tree/main/samples)** +**[You can find a list of samples here](https://github.com/ballerina-platform/module-ballerinax-microsoft.onenote/tree/main/examples)** diff --git a/onenote/Package.md b/ballerina/Package.md similarity index 100% rename from onenote/Package.md rename to ballerina/Package.md diff --git a/onenote/constants.bal b/ballerina/constants.bal similarity index 100% rename from onenote/constants.bal rename to ballerina/constants.bal diff --git a/onenote/endpoint.bal b/ballerina/endpoint.bal similarity index 100% rename from onenote/endpoint.bal rename to ballerina/endpoint.bal diff --git a/onenote/icon.png b/ballerina/icon.png similarity index 100% rename from onenote/icon.png rename to ballerina/icon.png diff --git a/onenote/tests/test.bal b/ballerina/tests/test.bal similarity index 100% rename from onenote/tests/test.bal rename to ballerina/tests/test.bal diff --git a/onenote/types.bal b/ballerina/types.bal similarity index 100% rename from onenote/types.bal rename to ballerina/types.bal diff --git a/onenote/utils.bal b/ballerina/utils.bal similarity index 100% rename from onenote/utils.bal rename to ballerina/utils.bal diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..28ec345 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,34 @@ +# Examples + +This directory contains a collection of sample code examples written in Ballerina. These examples demonstrate various +use cases of the module. You can follow the instructions below to build and run these examples. + +## Running an Example + +Execute the following commands to build an example from the source. + +* To build an example + + `bal build ` + + +* To run an example + + `bal run ` + +## Building the Examples with the Local Module + +**Warning**: Because of the absence of support for reading local repositories for single Ballerina files, the bala of +the module is manually written to the central repository as a workaround. Consequently, the bash script may modify your +local Ballerina repositories. + +Execute the following commands to build all the examples against the changes you have made to the module locally. + +* To build all the examples + + `./build.sh build` + + +* To run all the examples + + `./build.sh run` \ No newline at end of file diff --git a/examples/build.sh b/examples/build.sh new file mode 100755 index 0000000..f533627 --- /dev/null +++ b/examples/build.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +BAL_EXAMPLES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +BAL_CENTRAL_DIR="$HOME/.ballerina/repositories/central.ballerina.io/" +BAL_HOME_DIR="$BAL_EXAMPLES_DIR/../ballerina" + +set -e + +case "$1" in +build) + BAL_CMD="build" + ;; +run) + BAL_CMD="run" + ;; +*) + echo "Invalid command provided: '$1'. Please provide 'build' or 'run' as the command." + exit 1 + ;; +esac + +# Read Ballerina package name +BAL_PACKAGE_NAME=$(awk -F'"' '/^name/ {print $2}' "$BAL_HOME_DIR/Ballerina.toml") + +# Push the package to the local repository +cd "$BAL_HOME_DIR" && + bal pack && + bal push --repository=local + +# Remove the cache directories in the repositories +cacheDirs=($(ls -d "$BAL_CENTRAL_DIR"/cache-* 2>/dev/null)) +for dir in "${cacheDirs[@]}"; do + [ -d "$dir" ] && rm -r "$dir" +done +echo "Successfully cleaned the cache directories" + +# Update the central repository +BAL_DESTINATION_DIR="$HOME/.ballerina/repositories/central.ballerina.io/bala/ballerinax/$BAL_PACKAGE_NAME" +BAL_SOURCE_DIR="$HOME/.ballerina/repositories/local/bala/ballerinax/$BAL_PACKAGE_NAME" +[ -d "$BAL_DESTINATION_DIR" ] && rm -r "$BAL_DESTINATION_DIR" +[ -d "$BAL_SOURCE_DIR" ] && cp -r "$BAL_SOURCE_DIR" "$BAL_DESTINATION_DIR" +echo "Successfully updated the local central repositories" + +# Loop through examples in the examples directory +find "$BAL_EXAMPLES_DIR" -type f -name "*.bal" | while read -r BAL_EXAMPLE_FILE; do + bal "$BAL_CMD" --offline "$BAL_EXAMPLE_FILE" +done diff --git a/samples/createNotebook.bal b/examples/createNotebook.bal similarity index 94% rename from samples/createNotebook.bal rename to examples/createNotebook.bal index d07f38b..781ef3d 100644 --- a/samples/createNotebook.bal +++ b/examples/createNotebook.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:Notebook notebook = check oneNoteClient->createNotebook("test"); } diff --git a/samples/createPage.bal b/examples/createPage.bal similarity index 94% rename from samples/createPage.bal rename to examples/createPage.bal index fb99fc5..1edacc8 100644 --- a/samples/createPage.bal +++ b/examples/createPage.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:Page page = check oneNoteClient->createPage("sectionId", "title", "Hello"); } diff --git a/samples/createPageWithHTML.bal b/examples/createPageWithHTML.bal similarity index 94% rename from samples/createPageWithHTML.bal rename to examples/createPageWithHTML.bal index c87a7c3..c0fe9e7 100644 --- a/samples/createPageWithHTML.bal +++ b/examples/createPageWithHTML.bal @@ -26,7 +26,7 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); string testHtmlContent = "Test

Hello

"; onenote:Page page = check oneNoteClient->createPageWithHTML("sectionId", testHtmlContent); } diff --git a/samples/createSection.bal b/examples/createSection.bal similarity index 94% rename from samples/createSection.bal rename to examples/createSection.bal index 73663d2..c27d2d3 100644 --- a/samples/createSection.bal +++ b/examples/createSection.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:Section section = check oneNoteClient->createSection("notebookId", "testSection"); } diff --git a/samples/createSectionGroup.bal b/examples/createSectionGroup.bal similarity index 94% rename from samples/createSectionGroup.bal rename to examples/createSectionGroup.bal index bc2f84d..034369b 100644 --- a/samples/createSectionGroup.bal +++ b/examples/createSectionGroup.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:SectionGroup sectionGroup = check oneNoteClient->createSectionGroup("notebookId", "testSectionGroup"); } diff --git a/samples/createSectionInSectionGroup.bal b/examples/createSectionInSectionGroup.bal similarity index 94% rename from samples/createSectionInSectionGroup.bal rename to examples/createSectionInSectionGroup.bal index c518f3c..55c7700 100644 --- a/samples/createSectionInSectionGroup.bal +++ b/examples/createSectionInSectionGroup.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:Section section = check oneNoteClient->createSectionInSectionGroup("sectionGroupId", "section2"); } diff --git a/samples/deletePage.bal b/examples/deletePage.bal similarity index 94% rename from samples/deletePage.bal rename to examples/deletePage.bal index 4be4ab9..9345f2a 100644 --- a/samples/deletePage.bal +++ b/examples/deletePage.bal @@ -27,7 +27,7 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); error? response = check oneNoteClient->deletePage("pageId"); if (response is error) { log:printInfo("Failed to delete page"); diff --git a/samples/getNotebook.bal b/examples/getNotebook.bal similarity index 94% rename from samples/getNotebook.bal rename to examples/getNotebook.bal index 19bc660..cea92e4 100644 --- a/samples/getNotebook.bal +++ b/examples/getNotebook.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:Notebook notebook = check oneNoteClient->getNotebook("notebookId"); } diff --git a/samples/getPage.bal b/examples/getPage.bal similarity index 94% rename from samples/getPage.bal rename to examples/getPage.bal index 6571241..9974093 100644 --- a/samples/getPage.bal +++ b/examples/getPage.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:Page page = check oneNoteClient->getPage("pageId"); } diff --git a/samples/getRecentNotebooks.bal b/examples/getRecentNotebooks.bal similarity index 94% rename from samples/getRecentNotebooks.bal rename to examples/getRecentNotebooks.bal index e652be3..6495fca 100644 --- a/samples/getRecentNotebooks.bal +++ b/examples/getRecentNotebooks.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:RecentNotebook[] recentNotebooks = check oneNoteClient->getRecentNotebooks(); } diff --git a/samples/getSection.bal b/examples/getSection.bal similarity index 94% rename from samples/getSection.bal rename to examples/getSection.bal index 6e5068a..9f2603d 100644 --- a/samples/getSection.bal +++ b/examples/getSection.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:Section section = check oneNoteClient->getSection("sectionId"); } diff --git a/samples/getSectionGroup.bal b/examples/getSectionGroup.bal similarity index 94% rename from samples/getSectionGroup.bal rename to examples/getSectionGroup.bal index 9790889..5afd017 100644 --- a/samples/getSectionGroup.bal +++ b/examples/getSectionGroup.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:SectionGroup sectionGroup = check oneNoteClient->getSectionGroup("sectionGroupId"); } diff --git a/samples/listNotebooks.bal b/examples/listNotebooks.bal similarity index 94% rename from samples/listNotebooks.bal rename to examples/listNotebooks.bal index 095f6fc..f0b0068 100644 --- a/samples/listNotebooks.bal +++ b/examples/listNotebooks.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:Notebook[] notebooks = check oneNoteClient->listNotebooks(); } diff --git a/samples/listPages.bal b/examples/listPages.bal similarity index 94% rename from samples/listPages.bal rename to examples/listPages.bal index 4bbebbc..1c18da2 100644 --- a/samples/listPages.bal +++ b/examples/listPages.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:Page[] pages = check oneNoteClient->listPages("sectionId"); } diff --git a/samples/listSectionGroups.bal b/examples/listSectionGroups.bal similarity index 94% rename from samples/listSectionGroups.bal rename to examples/listSectionGroups.bal index bd9af55..47bd24c 100644 --- a/samples/listSectionGroups.bal +++ b/examples/listSectionGroups.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:SectionGroup[] sectionGroup = check oneNoteClient->listSectionGroups("notebookId"); } diff --git a/samples/listSections.bal b/examples/listSections.bal similarity index 94% rename from samples/listSections.bal rename to examples/listSections.bal index bdbf53a..14f101b 100644 --- a/samples/listSections.bal +++ b/examples/listSections.bal @@ -26,6 +26,6 @@ onenote:ConnectionConfig configuration = { }; public function main() returns error? { - onenote:Client oneNoteClient = check new(configuration); + onenote:Client oneNoteClient = check new (configuration); onenote:Section[] sections = check oneNoteClient->listSections("notebookId"); }