Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8c775f9
Generate the Ballerina clien
LinukaAr Jun 12, 2025
e1c5dcb
[Automated] Update the toml files
LinukaAr Jun 12, 2025
2e84333
[Automated] Update the toml files
LinukaAr Jun 12, 2025
29e40a8
add tests
LinukaAr Jun 16, 2025
5eede35
Regenarate files for updated bal version
LinukaAr Jun 19, 2025
699fdc7
Add tests
LinukaAr Jun 19, 2025
0ef3d5a
Update authentication mechanism
LinukaAr Jun 20, 2025
9005883
[Automated] Update the toml files
LinukaAr Jun 20, 2025
aa4c407
Address PR review comments
LinukaAr Jun 24, 2025
2fd43fd
Switch to zoom genaral app type
LinukaAr Jun 24, 2025
48868b7
[Automated] Update the toml files
LinukaAr Jun 24, 2025
4904d84
Add setup instructions
LinukaAr Jun 24, 2025
3d8747c
Add requested changes from code review
LinukaAr Jun 25, 2025
348c413
Change to specific types instead of json
LinukaAr Jun 25, 2025
530e29a
Update the cli command
LinukaAr Jun 25, 2025
7d7f878
Remove configurations related to tests
LinukaAr Jun 26, 2025
6a29409
Use markdown image syntax
LinukaAr Jun 26, 2025
285046f
Refactor error handling
LinukaAr Jun 26, 2025
a5d8608
Add missing details in doc
LinukaAr Jun 26, 2025
68bf4f1
Add sts service
LinukaAr Jun 27, 2025
084e64c
Update formatting in README
LinukaAr Jun 27, 2025
6b92ce7
Improve clarity in README files
LinukaAr Jun 27, 2025
82e7b1c
Merge branch 'ballerina-platform:main' into main
LinukaAr Jun 30, 2025
d0dfd00
Add examples for the connector
LinukaAr Jun 30, 2025
a260f5f
Add examples
LinukaAr Jun 30, 2025
0f1413c
Merge branch 'main' of https://github.com/LinukaAr/module-ballerinax-…
LinukaAr Jun 30, 2025
b1aa1c6
Address PR review comments
LinukaAr Jun 30, 2025
f3fc1e0
Add symlinks
LinukaAr Jun 30, 2025
22915d3
Refactor schedule segments
LinukaAr Jun 30, 2025
06968f7
Refactor event handling logic
LinukaAr Jun 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@

The `ballerinax/zoom.scheduler` connector provides practical examples illustrating usage in various scenarios.

[//]: # (TODO: Add examples)
1.
2.
1. **[Meeting Scheduler](https://github.com/ballerina-platform/module-ballerinax-zoom.scheduler/tree/main/examples/meeting-scheduler)** - Create scheduled meetings, generate single-use scheduling links, and manage team meeting schedules with automated booking capabilities.

2. **[Availability Manager](https://github.com/ballerina-platform/module-ballerinax-zoom.scheduler/tree/main/examples/availability-manager)** - Configure availability schedules, analyze scheduler analytics, and manage working hours for different time zones and business requirements.

## Prerequisites

[//]: # (TODO: Add prerequisites)
1. Generate Zoom credentials to authenticate the connector as described in the [Setup guide](https://central.ballerina.io/ballerinax/zoom.scheduler/latest#setup-guide).

2. For each example, create a Config.toml file the related configuration. Here's an example of how your Config.toml file should look:

```toml
isLiveServer = true
clientId = "your_client_id"
clientSecret = "your_client_secret"
refreshToken = "user_refresh_token_from_step"
userId = "user_id_from_step5"
```

## Running an example

Expand Down
8 changes: 8 additions & 0 deletions examples/availability-manager/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"image": "ballerina/ballerina-devcontainer:2201.12.7",
"customizations": {
"vscode": {
"extensions": ["WSO2.ballerina"]
}
}
}
11 changes: 11 additions & 0 deletions examples/availability-manager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Ballerina generates this directory during the compilation of a package.
# It contains compiler-generated artifacts and the final executable if this is an application package.
target/

# Ballerina maintains the compiler-generated source code here.
# Remove this if you want to commit generated sources.
generated/

# Contains configuration values used during development time.
# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.
Config.toml
30 changes: 30 additions & 0 deletions examples/availability-manager/Availability manager.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Zoom Scheduler Availability Manager

This example demonstrates how to manage availability schedules and retrieve analytics using the Zoom Scheduler connector in Ballerina. The example shows how to fetch user information, create availability schedules, and monitor scheduler analytics.

## Prerequisites

### 1. Setup Zoom developer account

Create a Zoom app with the following scopes:
- `scheduler:read`
- `scheduler:write`
- `user:read`

### 2. Configuration

Create a `Config.toml` file in the example's root directory and provide your Zoom account related configurations as follows:

```bash
clientId = "<Client ID>"
clientSecret = "<Client Secret>"
refreshToken = "<Refresh Token>"
userId = "<User ID>"
```

## Run the example

Execute the following command to run the example:

```bash
bal
8 changes: 8 additions & 0 deletions examples/availability-manager/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
org = "wso2"
name = "availability_manager"
version = "0.1.0"
distribution = "2201.12.7"

[build-options]
observabilityIncluded = true
133 changes: 133 additions & 0 deletions examples/availability-manager/main.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
// Copyright (c) 2025 WSO2 LLC. (http://www.wso2.com).
//
// WSO2 LLC. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import ballerina/io;
import ballerinax/zoom.scheduler;

configurable string clientId = ?;
configurable string clientSecret = ?;
configurable string refreshToken = ?;
configurable string userId = ?;

final scheduler:Client zoomClient = check new ({
auth: {
clientId,
clientSecret,
refreshUrl: "https://zoom.us/oauth/token",
refreshToken
}
});

public function main() returns error? {
scheduler:InlineResponse2007 userInfo = check zoomClient->/users/[userId].get();
io:println("User: ", userInfo.displayName, " | Timezone: ", userInfo.timeZone);
scheduler:InlineResponse200 analytics = check zoomClient->/analytics.get(
userId = userId,
'from = "2025-01-01",
to = "2025-12-31"
);

if analytics.lastNDays is scheduler:InlineResponse200LastNDays {
scheduler:InlineResponse200LastNDays stats = <scheduler:InlineResponse200LastNDays>analytics.lastNDays;
io:println("Analytics - Events Created: ", stats.scheduledEventsCreated ?: 0,
" | Completed: ", stats.scheduledEventsCompleted ?: 0,
" | Canceled: ", stats.scheduledEventsCanceled ?: 0);
}

scheduler:InlineResponse2001 availabilityResponse = check zoomClient->/availability.get(
userId = userId,
pageSize = 10
);

if availabilityResponse.items is scheduler:InlineResponse2001Items[] {
scheduler:InlineResponse2001Items[] availabilities = <scheduler:InlineResponse2001Items[]>availabilityResponse.items;
io:println("Availability Schedules: ", availabilities.length());
foreach scheduler:InlineResponse2001Items availability in availabilities {
io:println("- ", availability.name, " (", availability.timeZone, "), ID: ", availability.availabilityId);
io:println("Owner: ", availability.owner ?: "Unknown");
}
}

boolean shouldCreateNew = true;
if availabilityResponse.items is scheduler:InlineResponse2001Items[] {
scheduler:InlineResponse2001Items[] availabilities = <scheduler:InlineResponse2001Items[]>availabilityResponse.items;
int extendedHoursCount = 0;
foreach scheduler:InlineResponse2001Items availability in availabilities {
if availability.name == "Extended Office Hours" {
extendedHoursCount += 1;
}
}
if extendedHoursCount >= 3 {
shouldCreateNew = false;
io:println("Skipping creation - already have ", extendedHoursCount, " Extended Office Hours schedules");
}
}

if shouldCreateNew {
scheduler:SchedulerAvailabilityBody newAvailability = {
name: "Extended Office Hours",
timeZone: "America/New_York",
segmentsRecurrence: {
mon: [{
'start: "08:00",
end: "18:00"
}],
tue: [{
'start: "08:00",
end: "18:00"
}],
wed: [{
'start: "08:00",
end: "18:00"
}],
thu: [{
'start: "08:00",
end: "18:00"
}],
fri: [{
'start: "08:00",
end: "16:00"
}]
}
};

scheduler:InlineResponse201 createdAvailability = check zoomClient->/availability.post(
payload = newAvailability

io:println("Created new availability: ", createdAvailability.name, " (", createdAvailability.availabilityId, ")");
}

scheduler:InlineResponse2005|error allSchedulesResult = zoomClient->/schedules.get(
userId = userId,
pageSize = 5,
showDeleted = false
);

if allSchedulesResult is scheduler:InlineResponse2005 {
scheduler:InlineResponse2005 allSchedules = allSchedulesResult;
if allSchedules.items is scheduler:InlineResponse2005Items[] {
scheduler:InlineResponse2005Items[] schedules = <scheduler:InlineResponse2005Items[]>allSchedules.items;
io:println("Active Schedules: ", schedules.length());
foreach scheduler:InlineResponse2005Items schedule in schedules {
io:println("- ", schedule.summary, " (", schedule.duration, "min, ", schedule.capacity, " attendees)");
}
} else {
io:println("No schedules found");
}
} else {
io:println("Error fetching schedules: ", allSchedulesResult.message());
}
}
8 changes: 8 additions & 0 deletions examples/meeting-scheduler/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"image": "ballerina/ballerina-devcontainer:2201.12.7",
"customizations": {
"vscode": {
"extensions": ["WSO2.ballerina"]
}
}
}
11 changes: 11 additions & 0 deletions examples/meeting-scheduler/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Ballerina generates this directory during the compilation of a package.
# It contains compiler-generated artifacts and the final executable if this is an application package.
target/

# Ballerina maintains the compiler-generated source code here.
# Remove this if you want to commit generated sources.
generated/

# Contains configuration values used during development time.
# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.
Config.toml
8 changes: 8 additions & 0 deletions examples/meeting-scheduler/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
org = "wso2"
name = "meeting_scheduler"
version = "0.1.0"
distribution = "2201.12.7"

[build-options]
observabilityIncluded = true
30 changes: 30 additions & 0 deletions examples/meeting-scheduler/Meeting scheduler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Zoom Scheduler Meeting Scheduler

This example demonstrates how to create and manage meeting schedules using the Zoom Scheduler connector in Ballerina. The example shows how to create new schedules, fetch schedule details, and list existing schedules.

## Prerequisites

### 1. Setup Zoom developer account

Create a Zoom OAuth with the following scopes:
- `scheduler:read`
- `scheduler:write`
- `user:read`

### 2. Configuration

Create a `Config.toml` file in the example's root directory and provide your Zoom account related configurations as follows:

```bash
clientId = "<Client ID>"
clientSecret = "<Client Secret>"
refreshToken = "<Refresh Token>"
userId = "<User ID>"
```

## Run the example

Execute the following command to run the example:

```bash
bal run
Loading
Loading