Skip to content

Commit

Permalink
Merge pull request #9 from lckariyawasam/main
Browse files Browse the repository at this point in the history
Update test.bal and documentation
  • Loading branch information
ThisaruGuruge authored Jan 17, 2025
2 parents 027cced + 63b74a8 commit 1028985
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 37 deletions.
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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 a [developer test account](https://developers.hubspot.com/beta-docs/getting-started/account-types#developer-test-accounts) under your account to test apps and integrations without affecting any real HubSpot data.

Expand Down Expand Up @@ -158,16 +158,14 @@ import ballerina/oauth2;
configurable string clientSecret = ?;
configurable string refreshToken = ?;
final hsmemails:ConnectionConfig hsmeventsConfig = {
auth : {
clientId,
clientSecret,
refreshToken,
credentialBearer: oauth2:POST_BODY_BEARER
}
OAuth2RefreshTokenGrantConfig auth = {
clientId,
clientSecret,
refreshToken,
credentialBearer: oauth2:POST_BODY_BEARER
};
final hsmemails:Client hsmemailClient = check new (hsmeventsConfig);
final hsmemails:Client hsmemailClient = check new ({auth});
```

### Step 3: Invoke the connector operation
Expand All @@ -178,7 +176,7 @@ Now, utilize the available connector operations. A sample usecase is shown below

```ballerina
public function main() returns error? {
hsmemails:AggregateEmailStatistics emailStatistics = check hsmemailClient->/marketing/v3/emails/statistics/list({},
hsmemails:AggregateEmailStatistics emailStatistics = check hsmemailClient->statistics/list({},
{
startTimestamp: "2024-12-12T04:27:02Z",
endTimestamp: "2024-12-19T04:27:02Z"
Expand Down
18 changes: 8 additions & 10 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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 a [developer test account](https://developers.hubspot.com/beta-docs/getting-started/account-types#developer-test-accounts) under your account to test apps and integrations without affecting any real HubSpot data.

Expand Down Expand Up @@ -150,16 +150,14 @@ import ballerina/oauth2;
configurable string clientSecret = ?;
configurable string refreshToken = ?;
final hsmemails:ConnectionConfig hsmeventsConfig = {
auth : {
clientId,
clientSecret,
refreshToken,
credentialBearer: oauth2:POST_BODY_BEARER
}
OAuth2RefreshTokenGrantConfig auth = {
clientId,
clientSecret,
refreshToken,
credentialBearer: oauth2:POST_BODY_BEARER
};
final hsmemails:Client hsmemailClient = check new (hsmeventsConfig);
final hsmemails:Client hsmemailClient = check new ({auth});
```

### Step 3: Invoke the connector operation
Expand All @@ -170,7 +168,7 @@ Now, utilize the available connector operations. A sample usecase is shown below

```ballerina
public function main() returns error? {
hsmemails:AggregateEmailStatistics emailStatistics = check hsmemailClient->/marketing/v3/emails/statistics/list({},
hsmemails:AggregateEmailStatistics emailStatistics = check hsmemailClient->/statistics/list({},
{
startTimestamp: "2024-12-12T04:27:02Z",
endTimestamp: "2024-12-19T04:27:02Z"
Expand Down
18 changes: 8 additions & 10 deletions ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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 a [developer test account](https://developers.hubspot.com/beta-docs/getting-started/account-types#developer-test-accounts) under your account to test apps and integrations without affecting any real HubSpot data.

Expand Down Expand Up @@ -150,16 +150,14 @@ import ballerina/oauth2;
configurable string clientSecret = ?;
configurable string refreshToken = ?;
final hsmemails:ConnectionConfig hsmeventsConfig = {
auth : {
clientId,
clientSecret,
refreshToken,
credentialBearer: oauth2:POST_BODY_BEARER
}
OAuth2RefreshTokenGrantConfig auth = {
clientId,
clientSecret,
refreshToken,
credentialBearer: oauth2:POST_BODY_BEARER
};
final hsmemails:Client hsmemailClient = check new (hsmeventsConfig);
final hsmemails:Client hsmemailClient = check new ({auth});
```

### Step 3: Invoke the connector operation
Expand All @@ -170,7 +168,7 @@ Now, utilize the available connector operations. A sample usecase is shown below

```ballerina
public function main() returns error? {
hsmemails:AggregateEmailStatistics emailStatistics = check hsmemailClient->/marketing/v3/emails/statistics/list({},
hsmemails:AggregateEmailStatistics emailStatistics = check hsmemailClient->/statistics/list({},
{
startTimestamp: "2024-12-12T04:27:02Z",
endTimestamp: "2024-12-19T04:27:02Z"
Expand Down
7 changes: 0 additions & 7 deletions ballerina/tests/test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ final string refreshToken = os:getEnv("HUBSPOT_REFRESH_TOKEN");
configurable boolean isLiveServer = false;
configurable string serviceUrl = isLiveServer ? "https://api.hubapi.com/marketing/v3/emails" : "http://localhost:8080";

OAuth2RefreshTokenGrantConfig auth = {
clientId,
clientSecret,
refreshToken,
credentialBearer: oauth2:POST_BODY_BEARER // this line should be added to create auth object.
};

final Client hubspotClient = check initClient();

isolated function initClient() returns Client|error {
Expand Down

0 comments on commit 1028985

Please sign in to comment.