Skip to content
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 @@ -142,7 +142,7 @@ SimplePublicObjectInputForCreate payload = {
}
};

SimplePublicObject createResponse = check hubspotClient->/.post(payload, {});
SimplePublicObject createResponse = check hubspotClient->/.post(payload);
```

#### List all discounts
Expand All @@ -153,7 +153,7 @@ GetCrmV3ObjectsDiscountsQueries params = {
properties: ["hs_label", "hs_value", "hs_type"]
};

CollectionResponseSimplePublicObjectWithAssociationsForwardPaging response = check hubspotClient->/.get({}, params);
CollectionResponseSimplePublicObjectWithAssociationsForwardPaging response = check hubspotClient->/.get(queries=params);
```

## Examples
Expand Down
4 changes: 2 additions & 2 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ SimplePublicObjectInputForCreate payload = {
}
};

SimplePublicObject createResponse = check hubspotClient->/.post(payload, {});
SimplePublicObject createResponse = check hubspotClient->/.post(payload);
```

#### List all discounts
Expand All @@ -147,7 +147,7 @@ GetCrmV3ObjectsDiscountsQueries params = {
properties: ["hs_label", "hs_value", "hs_type"]
};

CollectionResponseSimplePublicObjectWithAssociationsForwardPaging response = check hubspotClient->/.get({}, params);
CollectionResponseSimplePublicObjectWithAssociationsForwardPaging response = check hubspotClient->/.get(queries=params);
```

## Examples
Expand Down
4 changes: 2 additions & 2 deletions ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ SimplePublicObjectInputForCreate payload = {
}
};

SimplePublicObject createResponse = check hubspotClient->/.post(payload, {});
SimplePublicObject createResponse = check hubspotClient->/.post(payload);
```

#### List all discounts
Expand All @@ -147,7 +147,7 @@ GetCrmV3ObjectsDiscountsQueries params = {
properties: ["hs_label", "hs_value", "hs_type"]
};

CollectionResponseSimplePublicObjectWithAssociationsForwardPaging response = check hubspotClient->/.get({}, params);
CollectionResponseSimplePublicObjectWithAssociationsForwardPaging response = check hubspotClient->/.get(queries=params);
```

## Examples
Expand Down
6 changes: 3 additions & 3 deletions ballerina/tests/mock_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ function testMockBatchUpsert() returns error? {
};

BatchResponseSimplePublicUpsertObject|BatchResponseSimplePublicUpsertObjectWithErrors upsertResponse =
check mockClient->/batch/upsert.post(payload, {});
check mockClient->/batch/upsert.post(payload);

if (upsertResponse is BatchResponseSimplePublicUpsertObjectWithErrors) {
if upsertResponse is BatchResponseSimplePublicUpsertObjectWithErrors {
test:assertFail("Batch upsert failed");
}
test:assertNotEquals(upsertResponse.results[0].id, ());
Expand All @@ -71,7 +71,7 @@ function testMockList() returns error? {
};

CollectionResponseSimplePublicObjectWithAssociationsForwardPaging response =
check mockClient->/.get({}, params);
check mockClient->/.get(queries = params);

test:assertNotEquals(response.results, [], "No discounts found");
test:assertTrue(response.results.length() <= 10, "Limit Exceeded");
Expand Down
36 changes: 18 additions & 18 deletions ballerina/tests/tests.bal
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ConnectionConfig config = {
};

// create live client
final Client hubspotClient = check new (config);
final Client hsClient = check new (config);

@test:Config {
groups: ["live_service_test"]
Expand All @@ -62,7 +62,7 @@ function testList() returns error? {
};

CollectionResponseSimplePublicObjectWithAssociationsForwardPaging response =
check hubspotClient->/.get({}, params);
check hsClient->/.get(queries = params);

test:assertNotEquals(response.results, [], "No discounts found");
test:assertTrue(response.results.length() <= 10, "Limit Exceeded");
Expand All @@ -82,7 +82,7 @@ function testRead() returns error? {
properties: ["hs_label", "hs_value", "hs_type"]
};

SimplePublicObjectWithAssociations response = check hubspotClient->/[discountId].get({}, params);
SimplePublicObjectWithAssociations response = check hsClient->/[discountId].get(queries = params);

test:assertNotEquals(response.id, (), "Discount id is not found");
test:assertNotEquals(response.properties, (), "Discount properties are not found");
Expand All @@ -104,7 +104,7 @@ function testUpdate() returns error? {
}
};

SimplePublicObject updateResponse = check hubspotClient->/[discountId].patch(payload, {});
SimplePublicObject updateResponse = check hsClient->/[discountId].patch(payload);

test:assertEquals(updateResponse.properties["hs_value"], newHsValue, "Discount value is not updated");
test:assertEquals(updateResponse.properties["hs_label"], newHsLabel, "Discount label is not updated");
Expand All @@ -115,7 +115,7 @@ function testUpdate() returns error? {
groups: ["live_service_test"]
}
function testArchive() returns error? {
http:Response deleteResponse = check hubspotClient->/[discountId].delete({});
http:Response deleteResponse = check hsClient->/[discountId].delete();

test:assertEquals(deleteResponse.statusCode, 204, "Discount is not deleted");
}
Expand All @@ -140,7 +140,7 @@ function testCreate() returns error? {
}
};

SimplePublicObject createResponse = check hubspotClient->/.post(payload, {});
SimplePublicObject createResponse = check hsClient->/.post(payload);

test:assertFalse(createResponse.archived ?: true, "Discount is archived");
test:assertFalse(createResponse.id == "", "Discount id is not valid");
Expand Down Expand Up @@ -177,9 +177,9 @@ function testBatchUpdate() returns error? {
};

BatchResponseSimplePublicObject|BatchResponseSimplePublicObjectWithErrors batchUpdateResponse =
check hubspotClient->/batch/update.post(payload, {});
check hsClient->/batch/update.post(payload);

if (batchUpdateResponse is BatchResponseSimplePublicObjectWithErrors) {
if batchUpdateResponse is BatchResponseSimplePublicObjectWithErrors {
test:assertFail("Batch update failed");
}

Expand All @@ -188,7 +188,7 @@ function testBatchUpdate() returns error? {
test:assertNotEquals(batchUpdateResponse.results[0].id, (), "Update failed as id varies");
test:assertNotEquals(batchUpdateResponse.results[1].id, (), "Update failed as id varies");

if (batchUpdateResponse.results[0].id == batchDiscountIds[0]) {
if batchUpdateResponse.results[0].id == batchDiscountIds[0] {
test:assertEquals(batchUpdateResponse.results[0].properties["hs_value"],
"30", "Discount value is not updated");
test:assertEquals(batchUpdateResponse.results[0].properties["hs_label"],
Expand All @@ -199,7 +199,7 @@ function testBatchUpdate() returns error? {
"test_batch_discount_update_2", "Discount label is not updated");
}

if (batchUpdateResponse.results[0].id == batchDiscountIds[1]) {
if batchUpdateResponse.results[0].id == batchDiscountIds[1] {
test:assertEquals(batchUpdateResponse.results[0].properties["hs_value"],
"40", "Discount value is not updated");
test:assertEquals(batchUpdateResponse.results[0].properties["hs_label"],
Expand Down Expand Up @@ -227,9 +227,9 @@ function testBatchRead() returns error? {
};

BatchResponseSimplePublicObject|BatchResponseSimplePublicObjectWithErrors batchReadResponse =
check hubspotClient->/batch/read.post(payload, {});
check hsClient->/batch/read.post(payload);

if (batchReadResponse is BatchResponseSimplePublicObjectWithErrors) {
if batchReadResponse is BatchResponseSimplePublicObjectWithErrors {
test:assertFail("Batch read failed");
}

Expand Down Expand Up @@ -286,9 +286,9 @@ function testBatchCreate() returns error? {
]
};
BatchResponseSimplePublicObject|BatchResponseSimplePublicObjectWithErrors batchCreateResponse =
check hubspotClient->/batch/create.post(payload, {});
check hsClient->/batch/create.post(payload);

if (batchCreateResponse is BatchResponseSimplePublicObjectWithErrors) {
if batchCreateResponse is BatchResponseSimplePublicObjectWithErrors {
test:assertFail("Batch create failed");
}

Expand All @@ -303,7 +303,7 @@ function testBatchCreate() returns error? {

// preparing discount ids for batch tests
int i = 0;
while (i < batchCreateResponse.results.length()) {
while i < batchCreateResponse.results.length() {
batchDiscountIds.push(batchCreateResponse.results[i].id);
i = i + 1;
}
Expand All @@ -322,7 +322,7 @@ function testBatchArchive() returns error? {
]
};

http:Response batchArchiveResponse = check hubspotClient->/batch/archive.post(payload, {});
http:Response batchArchiveResponse = check hsClient->/batch/archive.post(payload);

test:assertEquals(batchArchiveResponse.statusCode, 204, "Batch archive failed");
}
Expand All @@ -340,13 +340,13 @@ function testSearch() returns error? {
};

CollectionResponseWithTotalSimplePublicObjectForwardPaging searchResponse =
check hubspotClient->/search.post(payload, {});
check hsClient->/search.post(payload);

test:assertNotEquals(searchResponse.results, [], "No search results found");
test:assertTrue(searchResponse.results.length() <= 10, "Limit Exceeded");

int i = 0;
while (i < searchResponse.results.length()) {
while i < searchResponse.results.length() {
test:assertNotEquals(searchResponse.results[i].id, (), "Discount id is not found");
test:assertNotEquals(searchResponse.results[i].properties, (), "Discount properties are not found");
test:assertNotEquals(searchResponse.results[i].properties["hs_type"], (), "Discount type is not found");
Expand Down
10 changes: 5 additions & 5 deletions examples/discount_manager/main.bal
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ discounts:ConnectionConfig config = {
};

// create client
final discounts:Client hubspotClient = check new (config);
final discounts:Client hsClient = check new (config);

public function main() returns error? {
string createdDiscountId = "";
Expand All @@ -52,7 +52,7 @@ public function main() returns error? {
}
};

discounts:SimplePublicObject createResponse = check hubspotClient->/.post(createPayload, {});
discounts:SimplePublicObject createResponse = check hsClient->/.post(createPayload);

io:println("Discount created successfully with id: " + createResponse.id.toString());
createdDiscountId = createResponse.id.toString();
Expand All @@ -66,7 +66,7 @@ public function main() returns error? {
}
};

discounts:SimplePublicObject updateResponse = check hubspotClient->/[createdDiscountId].patch(updatePayload, {});
discounts:SimplePublicObject updateResponse = check hsClient->/[createdDiscountId].patch(updatePayload);

io:println("Discount updated successfully with id: " + updateResponse.id.toString());

Expand All @@ -76,12 +76,12 @@ public function main() returns error? {
};

discounts:SimplePublicObjectWithAssociations readResponse =
check hubspotClient->/[createdDiscountId].get({}, readParams);
check hsClient->/[createdDiscountId].get(queries = readParams);

io:println("Discount read successfully with id: " + readResponse.id.toString());

// delete a discount
http:Response deleteResponse = check hubspotClient->/[createdDiscountId].delete({});
http:Response deleteResponse = check hsClient->/[createdDiscountId].delete();
if deleteResponse.statusCode == 204 {
io:println("Discount deleted successfully with id: " + createdDiscountId);
} else {
Expand Down
18 changes: 9 additions & 9 deletions examples/festival_discounts/main.bal
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ discounts:ConnectionConfig config = {
};

// create client
final discounts:Client hubspotClient = check new (config);
final discounts:Client hsClient = check new (config);

public function main() returns error? {
// store discount ids for batch endpoints
Expand Down Expand Up @@ -66,9 +66,9 @@ public function main() returns error? {
};

discounts:BatchResponseSimplePublicObject|discounts:BatchResponseSimplePublicObjectWithErrors batchCreateResponse =
check hubspotClient->/batch/create.post(batchCreatePayload, {});
check hsClient->/batch/create.post(batchCreatePayload);

if (batchCreateResponse is discounts:BatchResponseSimplePublicObjectWithErrors) {
if batchCreateResponse is discounts:BatchResponseSimplePublicObjectWithErrors {
io:println("Error occurred while creating discounts");
return;
}
Expand All @@ -88,9 +88,9 @@ public function main() returns error? {
};

discounts:BatchResponseSimplePublicObject|discounts:BatchResponseSimplePublicObjectWithErrors batchReadResponse =
check hubspotClient->/batch/read.post(batchReadPayload, {});
check hsClient->/batch/read.post(batchReadPayload);

if (batchReadResponse is discounts:BatchResponseSimplePublicObjectWithErrors) {
if batchReadResponse is discounts:BatchResponseSimplePublicObjectWithErrors {
io:println("Error occurred while reading discounts");
return;
}
Expand Down Expand Up @@ -119,9 +119,9 @@ public function main() returns error? {
};

discounts:BatchResponseSimplePublicObject|discounts:BatchResponseSimplePublicObjectWithErrors batchUpdateResponse =
check hubspotClient->/batch/update.post(batchUpdatePayload, {});
check hsClient->/batch/update.post(batchUpdatePayload);

if (batchUpdateResponse is discounts:BatchResponseSimplePublicObjectWithErrors) {
if batchUpdateResponse is discounts:BatchResponseSimplePublicObjectWithErrors {
io:println("Error occurred while updating discounts");
return;
}
Expand All @@ -138,7 +138,7 @@ public function main() returns error? {
};

discounts:CollectionResponseWithTotalSimplePublicObjectForwardPaging searchResponse =
check hubspotClient->/search.post(searchPayload, {});
check hsClient->/search.post(searchPayload);

foreach discounts:SimplePublicObject obj in searchResponse.results {
io:println("Discount found from search with id: " + obj.id.toString());
Expand All @@ -153,7 +153,7 @@ public function main() returns error? {
};

http:Response batchArchiveResponse =
check hubspotClient->/batch/archive.post(batchArchivePayload, {});
check hsClient->/batch/archive.post(batchArchivePayload);

if batchArchiveResponse.statusCode == 204 {
io:println("Discounts archived successfully");
Expand Down
Loading