Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Mock Server for Tests #290

Merged
merged 10 commits into from
Mar 29, 2024
Merged
23 changes: 22 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Compiled class file
*.class
*.balx

# Log file
*.log

# BlueJ files
ballerina.conf
*.ctxt

# Mobile Tools for Java (J2ME)
Expand All @@ -25,12 +27,31 @@ hs_err_pid*
#Ballerina configuartion file
ballerina.conf
Config.toml
DimuthuMadushan marked this conversation as resolved.
Show resolved Hide resolved
!/ballerina/tests/Config.toml
docker.env

# .DS_Store
.DS_Store

#Target folder of ballerina project
/target
target
.classpath
.settings
.project
*.iml
*.iws
*.ipr
.idea
.m2
.vscode/

# Ignore ballerina files
accessToken.bal
temp.bal.ballerina/
target/
.DS_Store
*.deb
examples/**/Dependencies.toml

DimuthuMadushan marked this conversation as resolved.
Show resolved Hide resolved
#json files created inside resources folder
**/resources/*.json
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ The `ballerinax/googleapis.gsheets` package offers APIs to connect and interact

## Setup guide

To use the Google Sheets connector, you must have access to the Google Sheets API through a Google Cloud Platform (GCP)(https://console.cloud.google.com/) account and a project under it. If you do not have a GCP account, you can sign up for one [here](https://cloud.google.com/).
To use the Google Sheets connector, you must have access to the Google Sheets API through a [Google Cloud Platform (GCP)](https://console.cloud.google.com/) account and a project under it. If you do not have a GCP account, you can sign up for one [here](https://cloud.google.com/).

### Step 1: Create a Google Cloud Platform project

1. Open the [Google Cloud Platform Console](https://console.cloud.google.com/).

2. Click on **Select a project** in the drop-down menu and either select an existing project or create a new one.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/gcp-console-project-view.png alt="GCP Console Project View" width="50%">
![Enable Google Sheets API](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/gcp-console-project-view.png)

### Step 2: Enabling Google Sheets API

Expand All @@ -30,7 +30,7 @@ To use the Google Sheets connector, you must have access to the Google Sheets AP

3. Search and select `Google Sheets API`. Then click **ENABLE**.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/enable-sheets-api.png alt="Enable Google Sheets API" width="50%">
![Enable Sheets Api](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/enable-sheets-api.png)

### Step 3: Creating an OAuth consent app

Expand All @@ -40,15 +40,15 @@ To use the Google Sheets connector, you must have access to the Google Sheets AP

3. Fill in the app information and add the necessary scopes for Google Sheets API.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/oauth-consent.png alt="OAuth Consent Screen" width="50%">
![OAuth Consent Screen](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/oauth-consent.png)

### Step 4: Generating client ID & client secret

1. In the left sidebar, click on **Credentials**.

2. Click on **+ CREATE CREDENTIALS** and choose **OAuth Client ID**.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/create-credentials.png alt="Create Credentials" width="50%">
![Create Credentials](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/create-credentials.png)

3. You will be directed to the OAuth consent screen, in which you need to fill in the necessary information below.

Expand All @@ -58,7 +58,7 @@ To use the Google Sheets connector, you must have access to the Google Sheets AP
| Name | Sheets Client |
| Authorized Redirect URIs | <https://developers.google.com/oauthplayground> |

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/create-client.png alt="Create Client" width="50%">
![Create Client](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/create-client.png)

### Step 5: Obtain the access and refresh tokens

Expand All @@ -68,15 +68,15 @@ Follow these steps to generate the access and refresh tokens.

1. Configure the [OAuth playground](https://developers.google.com/oauthplayground) with the OAuth client ID and client secret.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/oauth-playground-config.png alt="OAuth Playground" width="50%">
![OAuth Playground](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/oauth-playground-config.png)

2. Authorize the Google Sheets APIs.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/auhtorize-apis.png alt="Authorize APIs" width="50%">
![Authorize APIs](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/auhtorize-apis.png)

3. Exchange the authorization code for tokens.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/exchange-tokens.png alt="Exchange Tokens" width="50%">
![Exchange Tokens](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/exchange-tokens.png)

## Quickstart

Expand Down Expand Up @@ -136,13 +136,13 @@ bal run

## Examples

The `Google Sheets` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/main/examples), covering use cases like creating, reading, and appending rows.
The `Google Sheets` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/master/examples), covering use cases like creating, reading, and appending rows.

1. [Cell operations](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/main/examples/cell-operations) - Operations associated with a cell, such as clearing, setting, and deleting cell values.
1. [Cell operations](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/master/examples/cell-operations) - Operations associated with a cell, such as clearing, setting, and deleting cell values.

2. [Grid filtering](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/main/examples/grid-filtering) - Demonstrate filtering sheet values using a grid range.
2. [Grid filtering](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/master/examples/grid-filtering) - Demonstrate filtering sheet values using a grid range.

3. [Sheet modifying](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/main/examples/sheet-modifying) - Basic operations associated with sheets such as creating, reading, and appending rows.
3. [Sheet modifying](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/master/examples/sheet-modifying) - Basic operations associated with sheets such as creating, reading, and appending rows.

## Build from the source

Expand Down
51 changes: 0 additions & 51 deletions ballerina/.gitignore

This file was deleted.

45 changes: 18 additions & 27 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.8.4"
distribution-version = "2201.8.5"

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -61,7 +61,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.8"
version = "2.10.12"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "cache"},
Expand Down Expand Up @@ -103,9 +103,6 @@ dependencies = [
org = "ballerina"
name = "jballerina.java"
version = "0.0.0"
modules = [
{org = "ballerina", packageName = "jballerina.java", moduleName = "jballerina.java"}
]

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -138,9 +135,6 @@ dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.__internal"}
]
modules = [
{org = "ballerina", packageName = "lang.array", moduleName = "lang.array"}
]

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -168,9 +162,6 @@ dependencies = [
{org = "ballerina", name = "lang.__internal"},
{org = "ballerina", name = "lang.object"}
]
modules = [
{org = "ballerina", packageName = "lang.int", moduleName = "lang.int"}
]

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -309,27 +300,30 @@ dependencies = [
]

[[package]]
org = "ballerinai"
name = "observe"
version = "0.0.0"
org = "ballerina"
name = "uuid"
version = "1.7.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "observe"}
{org = "ballerina", name = "lang.int"},
{org = "ballerina", name = "time"}
]
modules = [
{org = "ballerinai", packageName = "observe", moduleName = "observe"}
{org = "ballerina", packageName = "uuid", moduleName = "uuid"}
]

[[package]]
org = "ballerinax"
name = "client.config"
version = "1.0.1"
org = "ballerinai"
name = "observe"
version = "0.0.0"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "oauth2"}
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "observe"}
]
modules = [
{org = "ballerinax", packageName = "client.config", moduleName = "client.config"}
{org = "ballerinai", packageName = "observe", moduleName = "observe"}
]

[[package]]
Expand All @@ -338,15 +332,12 @@ name = "googleapis.gsheets"
version = "4.0.0"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.array"},
{org = "ballerina", name = "lang.int"},
{org = "ballerina", name = "lang.regexp"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "os"},
{org = "ballerina", name = "test"},
{org = "ballerinai", name = "observe"},
{org = "ballerinax", name = "client.config"}
{org = "ballerina", name = "uuid"},
{org = "ballerinai", name = "observe"}
]
modules = [
{org = "ballerinax", packageName = "googleapis.gsheets", moduleName = "googleapis.gsheets"}
Expand Down
26 changes: 13 additions & 13 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ The `ballerinax/googleapis.gsheets` package offers APIs to connect and interact

## Setup guide

To use the Google Sheets connector, you must have access to the Google Sheets API through a Google Cloud Platform (GCP)(https://console.cloud.google.com/) account and a project under it. If you do not have a GCP account, you can sign up for one [here](https://cloud.google.com/).
To use the Google Sheets connector, you must have access to the Google Sheets API through a [Google Cloud Platform (GCP)](https://console.cloud.google.com/) account and a project under it. If you do not have a GCP account, you can sign up for one [here](https://cloud.google.com/).

### Step 1: Create a Google Cloud Platform project

1. Open the [Google Cloud Platform Console](https://console.cloud.google.com/).

2. Click on **Select a project** in the drop-down menu and either select an existing project or create a new one.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/gcp-console-project-view.png alt="GCP Console Project View" width="50%">
![Enable Google Sheets API](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/gcp-console-project-view.png)

### Step 2: Enabling Google Sheets API

Expand All @@ -24,7 +24,7 @@ To use the Google Sheets connector, you must have access to the Google Sheets AP

3. Search and select `Google Sheets API`. Then click **ENABLE**.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/enable-sheets-api.png alt="Enable Google Sheets API" width="50%">
![Enable Sheets Api](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/enable-sheets-api.png)

### Step 3: Creating an OAuth consent app

Expand All @@ -34,15 +34,15 @@ To use the Google Sheets connector, you must have access to the Google Sheets AP

3. Fill in the app information and add the necessary scopes for Google Sheets API.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/oauth-consent.png alt="OAuth Consent Screen" width="50%">
![OAuth Consent Screen](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/oauth-consent.png)

### Step 4: Generating client ID & client secret

1. In the left sidebar, click on **Credentials**.

2. Click on **+ CREATE CREDENTIALS** and choose **OAuth Client ID**.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/create-credentials.png alt="Create Credentials" width="50%">
![Create Credentials](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/create-credentials.png)

3. You will be directed to the OAuth consent screen, in which you need to fill in the necessary information below.

Expand All @@ -52,7 +52,7 @@ To use the Google Sheets connector, you must have access to the Google Sheets AP
| Name | Sheets Client |
| Authorized Redirect URIs | <https://developers.google.com/oauthplayground> |

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/create-client.png alt="Create Client" width="50%">
![Create Client](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/create-client.png)

### Step 5: Obtain the access and refresh tokens

Expand All @@ -62,15 +62,15 @@ Follow these steps to generate the access and refresh tokens.

1. Configure the [OAuth playground](https://developers.google.com/oauthplayground) with the OAuth client ID and client secret.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/oauth-playground-config.png alt="OAuth Playground" width="50%">
![OAuth Playground](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/oauth-playground-config.png)

2. Authorize the Google Sheets APIs.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/auhtorize-apis.png alt="Authorize APIs" width="50%">
![Authorize APIs](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/auhtorize-apis.png)

3. Exchange the authorization code for tokens.

<img src=https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/main/docs/setup/resources/exchange-tokens.png alt="Exchange Tokens" width="50%">
![Exchange Tokens](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-googleapis.sheets/master/docs/setup/resources/exchange-tokens.png)

## Quickstart

Expand Down Expand Up @@ -130,10 +130,10 @@ bal run

## Examples

The `Google Sheets` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/main/examples), covering use cases such as creating, reading, and appending rows.
The `Google Sheets` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/master/examples), covering use cases such as creating, reading, and appending rows.

1. [Cell operations](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/main/examples/cell-operations) - Operations associated with a cell, such as clearing, setting, and deleting cell values.
1. [Cell operations](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/master/examples/cell-operations) - Operations associated with a cell, such as clearing, setting, and deleting cell values.

2. [Grid filtering](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/main/examples/grid-filtering) - Demonstrate filtering sheet values using a grid range.
2. [Grid filtering](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/master/examples/grid-filtering) - Demonstrate filtering sheet values using a grid range.

3. [Sheet modifying](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/main/examples/sheet-modifying) - Basic operations associated with sheets such as creating, reading, and appending rows.
3. [Sheet modifying](https://github.com/ballerina-platform/module-ballerinax-googleapis.sheets/tree/master/examples/sheet-modifying) - Basic operations associated with sheets such as creating, reading, and appending rows.
Loading
Loading