Skip to content

Commit

Permalink
Merge pull request #4 from ParameswaranSajeenthiran/main
Browse files Browse the repository at this point in the history
Changes after Final Presentation Review.
  • Loading branch information
MohamedSabthar authored Jan 17, 2025
2 parents 6eebd8c + 2231bfc commit 1972583
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ actions:PublicActionDefinitionEgg testingPublicActionDefinitionEgg = {
}
};
actions: PublicActionDefinition response = check hubspotAutomation->/automation/v4/actions/[appId].post(testingPublicActionDefinitionEgg);
actions: PublicActionDefinition response = check hubspotAutomation->/[appId].post(testingPublicActionDefinitionEgg);
```

#### List definitions
Expand Down
4 changes: 4 additions & 0 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.value"}
]
modules = [
{org = "ballerina", packageName = "io", moduleName = "io"}
]

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -314,6 +317,7 @@ name = "hubspot.automation.actions"
version = "1.0.0"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "url"},
{org = "ballerinai", name = "observe"}
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ actions:PublicActionDefinitionEgg testingPublicActionDefinitionEgg = {
actions: PublicActionDefinition response = check hubspotAutomation->/automation/v4/actions/[appId].post(testingPublicActionDefinitionEgg);
actions: PublicActionDefinition response = check hubspotAutomation->/[appId].post(testingPublicActionDefinitionEgg);
```

#### List definitions
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ actions:PublicActionDefinitionEgg testingPublicActionDefinitionEgg = {
actions: PublicActionDefinition response = check hubspotAutomation->/automation/v4/actions/[appId].post(testingPublicActionDefinitionEgg);
actions: PublicActionDefinition response = check hubspotAutomation->/[appId].post(testingPublicActionDefinitionEgg);
```

#### List definitions
Expand Down
41 changes: 41 additions & 0 deletions ballerina/tests/mock_test.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import ballerina/test;
import ballerina/http;
import ballerina/io;

configurable string oauthKey = ?;

# Completes a batch of callbacks
#
# + return - error? if an error occurs, null otherwise
#
@test:Config {
groups: ["mock_tests"]
}
function testRespondBatch() returns error? {

// BearerTokenConfig
ConnectionConfig oauthConfig = {
auth: {
token: oauthKey
}
};

final Client hubspotAutomationOauth = check new Client(oauthConfig, "http://localhost:8080/mock");

BatchInputCallbackCompletionBatchRequest batchCallbackCompletionRequest = {
inputs: [
{
callbackId: "1",
outputFields: {
"exampleField": "exampleValue"
}
}
]
};
http:Response response = check hubspotAutomationOauth->/callbacks/complete.post(batchCallbackCompletionRequest);

io:print("Status Code ");
io:println(response.statusCode);
// assert response
test:assertTrue(response.statusCode == 204, "Batch completion failed");
}
1 change: 0 additions & 1 deletion ballerina/tests/test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import ballerina/http;
import ballerina/test;

configurable boolean isOauth = ?;
configurable string oauthKey = ?;
configurable string apiKey = ?;

int:Signed32 appId = 5712614;
Expand Down
9 changes: 9 additions & 0 deletions examples/callback-completion/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ dependencies = [
{org = "ballerina", name = "time"},
{org = "ballerina", name = "url"}
]
modules = [
{org = "ballerina", packageName = "http", moduleName = "http"},
{org = "ballerina", packageName = "http", moduleName = "http.httpscerr"}
]

[[package]]
org = "ballerina"
Expand All @@ -94,6 +98,9 @@ dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.value"}
]
modules = [
{org = "ballerina", packageName = "io", moduleName = "io"}
]

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -294,6 +301,8 @@ org = "wso2"
name = "callback_completion"
version = "0.1.0"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerinax", name = "hubspot.automation.actions"}
]
modules = [
Expand Down
5 changes: 4 additions & 1 deletion examples/callback-completion/main.bal
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// under the License.

import ballerinax/hubspot.automation.actions;
import ballerina/http;
import ballerina/io;

configurable string oauthKey = ?;

Expand All @@ -38,5 +40,6 @@ public function main() returns error? {
}
]
};
_ = check automationClient->/callbacks/complete.post(batchCallbackCompletionRequest);
http:Response response= check automationClient->/callbacks/complete.post(batchCallbackCompletionRequest);
io:println("Status Code: " + response.statusCode.toString());
}
2 changes: 2 additions & 0 deletions examples/extension-crud/main.bal
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,7 @@ public function main() returns error? {
// Delete Extension
http:Response deleteResponse = check hubspotAutomation->/[appId]/[createdExtensionId].delete();
io:println("Extension Deleted");
io:print("Status Code: ");
io:println(deleteResponse.statusCode);

}

0 comments on commit 1972583

Please sign in to comment.