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

Remove final in variables in examples #6

Merged
merged 4 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ If you have an account already, go to the [HubSpot developer portal](https://app

If you don't have a HubSpot Developer Account you can sign up to a free account [here](https://developers.hubspot.com/get-started)

### Step 2 (Optional): Create a [Developer Test Account](https://developers.hubspot.com/beta-docs/getting-started/account-types#developer-test-accounts) under your account
### Step 2 (Optional): Create a Developer Test Account under your account

Within app developer accounts, you can create developer test accounts to test apps and integrations without affecting any real HubSpot data.
Within app developer accounts, you can create [developer test accounts](https://developers.hubspot.com/beta-docs/getting-started/account-types#developer-test-accounts) to test apps and integrations without affecting any real HubSpot data.

**Note: These accounts are only for development and testing purposes. In production you should not use Developer Test Accounts.**

Expand Down
4 changes: 2 additions & 2 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ If you have an account already, go to the [HubSpot developer portal](https://app

If you don't have a HubSpot Developer Account you can sign up to a free account [here](https://developers.hubspot.com/get-started)

### Step 2 (Optional): Create a [Developer Test Account](https://developers.hubspot.com/beta-docs/getting-started/account-types#developer-test-accounts) under your account
### Step 2 (Optional): Create a Developer Test Account under your account

Within app developer accounts, you can create developer test accounts to test apps and integrations without affecting any real HubSpot data.
Within app developer accounts, you can create [developer test accounts](https://developers.hubspot.com/beta-docs/getting-started/account-types#developer-test-accounts) to test apps and integrations without affecting any real HubSpot data.

**Note: These accounts are only for development and testing purposes. In production you should not use Developer Test Accounts.**

Expand Down
4 changes: 2 additions & 2 deletions ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ If you have an account already, go to the [HubSpot developer portal](https://app

If you don't have a HubSpot Developer Account you can sign up to a free account [here](https://developers.hubspot.com/get-started)

### Step 2 (Optional): Create a [Developer Test Account](https://developers.hubspot.com/beta-docs/getting-started/account-types#developer-test-accounts) under your account
### Step 2 (Optional): Create a Developer Test Account under your account

Within app developer accounts, you can create developer test accounts to test apps and integrations without affecting any real HubSpot data.
Within app developer accounts, you can create [developer test accounts](https://developers.hubspot.com/beta-docs/getting-started/account-types#developer-test-accounts) to test apps and integrations without affecting any real HubSpot data.

**Note: These accounts are only for development and testing purposes. In production you should not use Developer Test Accounts.**

Expand Down
22 changes: 11 additions & 11 deletions examples/customer-behavior/main.bal
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ hsproperties:OAuth2RefreshTokenGrantConfig auth = {
};
final hsproperties:Client hubSpotProperties = check new ({ auth });

final string groupName = "customer_behavior";
final string customPropertyName = "purchase_frequency_property";
final string dependantPropertyName = "preferred_channel_property";
const GROUP_NAME = "customer_behavior";
const CUSTOM_PROPERTY_NAME = "purchase_frequency_property";
const DEPENDANT_PROPERTY_NAME = "preferred_channel_property";

public function main() returns error? {

// Step 1: Create a property group for Customer Behavior
hsproperties:PropertyGroupCreate behaviorGroupInput = {
name: groupName,
name: GROUP_NAME,
displayOrder: 1,
label: "Customer Behavior"
};
Expand All @@ -47,9 +47,9 @@ public function main() returns error? {

// Step 2: Create a custom property to track purchase frequency
hsproperties:PropertyCreate purchaseFrequencyProperty = {
"name": customPropertyName,
"label": customPropertyName,
"groupName": groupName,
"name": CUSTOM_PROPERTY_NAME,
"label": CUSTOM_PROPERTY_NAME,
"groupName": GROUP_NAME,
"type": "enumeration",
"fieldType": "select",
"description": "How often the customer makes purchases",
Expand All @@ -67,9 +67,9 @@ public function main() returns error? {

// Step 3: Create a dependent property for preferred communication channel
hsproperties:PropertyCreate preferredChannelProperty = {
"name": dependantPropertyName,
"label": dependantPropertyName,
"groupName": groupName, // Corrected groupName
"name": DEPENDANT_PROPERTY_NAME,
"label": DEPENDANT_PROPERTY_NAME,
"groupName": GROUP_NAME, // Corrected groupName
"type": "enumeration",
"fieldType": "radio",
"description": "Customer's preferred communication channel",
Expand All @@ -94,7 +94,7 @@ public function main() returns error? {
{"label": "Quarterly", "value": "quarterly", "displayOrder": 4, "hidden": false} // New option added
]
};
hsproperties:Property updatedPurchaseFrequency = check hubSpotProperties->/Contact/[customPropertyName].patch(payload = purchaseFrequencyUpdate);
hsproperties:Property updatedPurchaseFrequency = check hubSpotProperties->/Contact/[CUSTOM_PROPERTY_NAME].patch(payload = purchaseFrequencyUpdate);
io:println("Updated property: ", updatedPurchaseFrequency);

// Step 5: Log all created properties and groups
Expand Down
32 changes: 16 additions & 16 deletions examples/marketing-preference/main.bal
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ hsproperties:OAuth2RefreshTokenGrantConfig auth = {
};
final hsproperties:Client hubSpotProperties = check new ({ auth });

final string testObjectType = "Contact";
final string groupName = "marketing_preference";
final string emailPropertyName = "email_subscription";
final string smsPropertyName = "sms_subscription";
final string contactTimePropertyName = "preferred_contact_time";
const TEST_OBJECT_TYPE = "Contact";
const GROUP_NAME = "marketing_preference";
const EMAIL_PROPERTY_NAME = "email_subscription";
const SMS_PROPERTY_NAME = "sms_subscription";
const CONTACT_TIME_PROPERTY_NAME = "preferred_contact_time";

public function main() returns error? {
// Step 1: Create a property group for marketing preferences
hsproperties:PropertyGroupCreate propertyGroupInput = {
name: groupName,
name: GROUP_NAME,
displayOrder: 1,
label: "Marketing Preferences"
};
hsproperties:PropertyGroup groupResponse = check hubSpotProperties->/[testObjectType]/groups.post(payload = propertyGroupInput);
hsproperties:PropertyGroup groupResponse = check hubSpotProperties->/[TEST_OBJECT_TYPE]/groups.post(payload = propertyGroupInput);
io:println("Property group created: ", groupResponse);

// Step 2: Create Email Subscription and SMS Subscription properties in batch
hsproperties:BatchInputPropertyCreate batchInputPropertyCreate = {
inputs: [
{
"name": emailPropertyName,
"name": EMAIL_PROPERTY_NAME,
"label": "Email Subscription",
"groupName": groupName,
"groupName": GROUP_NAME,
"type": "enumeration",
"fieldType": "checkbox",
"description": "Track email subscription status",
Expand All @@ -77,9 +77,9 @@ public function main() returns error? {
"displayOrder": 1
},
{
"name": smsPropertyName,
"name": SMS_PROPERTY_NAME,
"label": "SMS Subscription",
"groupName": groupName,
"groupName": GROUP_NAME,
"type": "enumeration",
"fieldType": "checkbox",
"description": "Track SMS subscription status",
Expand All @@ -105,14 +105,14 @@ public function main() returns error? {
}
]
};
hsproperties:BatchResponseProperty batchResponse = check hubSpotProperties->/[testObjectType]/batch/create.post(payload = batchInputPropertyCreate);
hsproperties:BatchResponseProperty batchResponse = check hubSpotProperties->/[TEST_OBJECT_TYPE]/batch/create.post(payload = batchInputPropertyCreate);
io:println("Batch properties created: ", batchResponse);

// Step 3: Create a Preferred Contact Time property
hsproperties:PropertyCreate contactTimeProperty = {
"name": contactTimePropertyName,
"name": CONTACT_TIME_PROPERTY_NAME,
"label": "Preferred Contact Time",
"groupName": groupName,
"groupName": GROUP_NAME,
"type": "enumeration",
"fieldType": "radio",
"description": "Track customer's preferred contact time",
Expand Down Expand Up @@ -143,7 +143,7 @@ public function main() returns error? {
"formField": true,
"displayOrder": 3
};
hsproperties:Property contactTimeResponse = check hubSpotProperties->/[testObjectType].post(payload = contactTimeProperty);
hsproperties:Property contactTimeResponse = check hubSpotProperties->/[TEST_OBJECT_TYPE].post(payload = contactTimeProperty);
io:println("Property created: ", contactTimeResponse);

// Step 4: Update Email Subscription property to include a new "Paused" status
Expand All @@ -154,7 +154,7 @@ public function main() returns error? {
{label: "Paused", value: "paused", displayOrder: 3, hidden: false}
]
};
hsproperties:Property updatedProperty = check hubSpotProperties->/[testObjectType]/[emailPropertyName].patch(payload = emailUpdate);
hsproperties:Property updatedProperty = check hubSpotProperties->/[TEST_OBJECT_TYPE]/[EMAIL_PROPERTY_NAME].patch(payload = emailUpdate);
io:println("Property updated: ", updatedProperty);

}
Loading