From 9f2ad370d7b664ae517109cd41abaf105db99ec2 Mon Sep 17 00:00:00 2001 From: CharanaManawathilake Date: Sat, 18 Jan 2025 12:28:34 +0530 Subject: [PATCH 1/2] Change the access method of config values --- ballerina/tests/tests.bal | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 99cebef..f633425 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -19,23 +19,30 @@ import ballerina/io; import ballerina/oauth2; +import ballerina/os; import ballerina/test; -configurable string clientId = ?; -configurable string clientSecret = ?; -configurable string refreshToken = ?; - configurable boolean isLiveServer = false; configurable string serviceUrl = isLiveServer ? "https://api.hubapi.com/crm/v3/imports" : "http://localhost:9090"; -OAuth2RefreshTokenGrantConfig auth = { - clientId: clientId, - clientSecret: clientSecret, - refreshToken: refreshToken, - credentialBearer: oauth2:POST_BODY_BEARER -}; +function initClient() returns Client|error { + if isLiveServer { + OAuth2RefreshTokenGrantConfig auth = { + clientId: os:getEnv("HUBSPOT_CLIENT_ID"), + clientSecret: os:getEnv("HUBSPOT_CLIENT_SECRET"), + refreshToken: os:getEnv("HUBSPOT_REFRESH_TOKEN"), + credentialBearer: oauth2:POST_BODY_BEARER + }; + return check new ({auth}, serviceUrl); + } + return check new ({ + auth: { + token: "test-token" + } + }, serviceUrl); +} -final Client baseClient = check new ({auth}); +final Client baseClient = check initClient(); json readJson = check io:fileReadJson("tests/resources/dummy_import_request.json"); string importRequestString = readJson.toString(); From b5c549fd2d9ccbcd2379b050bd9196e8fb795248 Mon Sep 17 00:00:00 2001 From: CharanaManawathilake Date: Mon, 20 Jan 2025 13:03:41 +0530 Subject: [PATCH 2/2] Change image paths --- README.md | 20 ++++++++++---------- ballerina/Module.md | 20 ++++++++++---------- ballerina/Package.md | 20 ++++++++++---------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 32bd3d7..9c0061e 100644 --- a/README.md +++ b/README.md @@ -22,21 +22,21 @@ Within app developer accounts, you can create developer test accounts to test ap 1. Go to Test Account section from the left sidebar. - ![Hubspot developer portal](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/test_acc_1.png) + ![Hubspot developer portal](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/test_acc_1.png) 2. Click Create developer test account. - ![Hubspot developer test account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/test_acc_2.png) + ![Hubspot developer test account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/test_acc_2.png) 3. In the dialogue box, give a name to your test account and click create. - ![Create Hubspot developer test account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/test_acc_3.png) + ![Create Hubspot developer test account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/test_acc_3.png) ### Step 3: Create a HubSpot App under your account. 1. In your developer account, navigate to the "Apps" section. Click on "Create App" - ![Hubspot apps](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/create_app_1.png) + ![Hubspot apps](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/create_app_1.png) 2. Provide the necessary details, including the app name and description. @@ -44,23 +44,23 @@ Within app developer accounts, you can create developer test accounts to test ap 1. Move to the "Auth" Tab. - ![Hubspot app auth tab](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/create_app_2.png) + ![Hubspot app auth tab](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/create_app_2.png) 2. In the Scopes section, add the following scopes for your app using the "Add new scope" button. `crm.objects.import` - ![Add new scope](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/scope_set.png) + ![Add new scope](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/scope_set.png) 4. Add your Redirect URI in the relevant section. You can also use localhost addresses for local development purposes. Click Create App. - ![Create app](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/create_app_final.png) + ![Create app](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/create_app_final.png) ### Step 5: Get your Client ID and Client Secret - Navigate to the Auth section of your app. Make sure to save the provided Client ID and Client Secret. - ![Auth settings](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/get_credentials.png) + ![Auth settings](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/get_credentials.png) ### Step 6: Setup Authentication Flow @@ -76,7 +76,7 @@ Before proceeding with the Quickstart, ensure you have obtained the Access Token 2. Paste it in the browser and select your developer test account to install the app when prompted. - ![Choose account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/install_app.png) + ![Choose account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/install_app.png) 3. A code will be displayed in the browser. Copy the code. @@ -169,7 +169,7 @@ public function main() returns error? { ## Examples -The `HubSpot.crm.imports` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/examples), covering the following use cases: +The `HubSpot.crm.imports` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/examples), covering the following use cases: ## Build from the source diff --git a/ballerina/Module.md b/ballerina/Module.md index 0b4acdc..b309fe9 100644 --- a/ballerina/Module.md +++ b/ballerina/Module.md @@ -22,21 +22,21 @@ Within app developer accounts, you can create developer test accounts to test ap 1. Go to Test Account section from the left sidebar. - ![Hubspot developer portal](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/test_acc_1.png) + ![Hubspot developer portal](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/test_acc_1.png) 2. Click Create developer test account. - ![Hubspot developer test account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/test_acc_2.png) + ![Hubspot developer test account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/test_acc_2.png) 3. In the dialogue box, give a name to your test account and click create. - ![Create Hubspot developer test account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/test_acc_3.png) + ![Create Hubspot developer test account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/test_acc_3.png) ### Step 3: Create a HubSpot App under your account. 1. In your developer account, navigate to the "Apps" section. Click on "Create App" - ![Hubspot apps](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/create_app_1.png) + ![Hubspot apps](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/create_app_1.png) 2. Provide the necessary details, including the app name and description. @@ -44,23 +44,23 @@ Within app developer accounts, you can create developer test accounts to test ap 1. Move to the "Auth" Tab. - ![Hubspot app auth tab](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/create_app_2.png) + ![Hubspot app auth tab](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/create_app_2.png) 2. In the Scopes section, add the following scopes for your app using the "Add new scope" button. `crm.objects.import` - ![Add new scope](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/scope_set.png) + ![Add new scope](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/scope_set.png) 4. Add your Redirect URI in the relevant section. You can also use localhost addresses for local development purposes. Click Create App. - ![Create app](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/create_app_final.png) + ![Create app](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/create_app_final.png) ### Step 5: Get your Client ID and Client Secret - Navigate to the Auth section of your app. Make sure to save the provided Client ID and Client Secret. - ![Auth settings](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/get_credentials.png) + ![Auth settings](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/get_credentials.png) ### Step 6: Setup Authentication Flow @@ -76,7 +76,7 @@ Before proceeding with the Quickstart, ensure you have obtained the Access Token 2. Paste it in the browser and select your developer test account to install the app when prompted. - ![Choose account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/install_app.png) + ![Choose account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/install_app.png) 3. A code will be displayed in the browser. Copy the code. @@ -169,4 +169,4 @@ public function main() returns error? { ## Examples -The `HubSpot.crm.imports` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/examples), covering the following use cases: +The `HubSpot.crm.imports` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/examples), covering the following use cases: diff --git a/ballerina/Package.md b/ballerina/Package.md index 0b4acdc..b309fe9 100644 --- a/ballerina/Package.md +++ b/ballerina/Package.md @@ -22,21 +22,21 @@ Within app developer accounts, you can create developer test accounts to test ap 1. Go to Test Account section from the left sidebar. - ![Hubspot developer portal](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/test_acc_1.png) + ![Hubspot developer portal](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/test_acc_1.png) 2. Click Create developer test account. - ![Hubspot developer test account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/test_acc_2.png) + ![Hubspot developer test account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/test_acc_2.png) 3. In the dialogue box, give a name to your test account and click create. - ![Create Hubspot developer test account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/test_acc_3.png) + ![Create Hubspot developer test account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/test_acc_3.png) ### Step 3: Create a HubSpot App under your account. 1. In your developer account, navigate to the "Apps" section. Click on "Create App" - ![Hubspot apps](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/create_app_1.png) + ![Hubspot apps](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/create_app_1.png) 2. Provide the necessary details, including the app name and description. @@ -44,23 +44,23 @@ Within app developer accounts, you can create developer test accounts to test ap 1. Move to the "Auth" Tab. - ![Hubspot app auth tab](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/create_app_2.png) + ![Hubspot app auth tab](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/create_app_2.png) 2. In the Scopes section, add the following scopes for your app using the "Add new scope" button. `crm.objects.import` - ![Add new scope](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/scope_set.png) + ![Add new scope](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/scope_set.png) 4. Add your Redirect URI in the relevant section. You can also use localhost addresses for local development purposes. Click Create App. - ![Create app](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/create_app_final.png) + ![Create app](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/create_app_final.png) ### Step 5: Get your Client ID and Client Secret - Navigate to the Auth section of your app. Make sure to save the provided Client ID and Client Secret. - ![Auth settings](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/get_credentials.png) + ![Auth settings](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/get_credentials.png) ### Step 6: Setup Authentication Flow @@ -76,7 +76,7 @@ Before proceeding with the Quickstart, ensure you have obtained the Access Token 2. Paste it in the browser and select your developer test account to install the app when prompted. - ![Choose account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/docs/setup/resources/install_app.png) + ![Choose account](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/docs/setup/resources/install_app.png) 3. A code will be displayed in the browser. Copy the code. @@ -169,4 +169,4 @@ public function main() returns error? { ## Examples -The `HubSpot.crm.imports` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.import/tree/main/examples), covering the following use cases: +The `HubSpot.crm.imports` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.import/main/examples), covering the following use cases: