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

Generated client using OpenAPI spec tool, Updated package.md and Added tests #2

Merged
merged 88 commits into from
Jan 20, 2025
Merged
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
416d456
Added openapi specifications
Nayanatharapmc Dec 17, 2024
24e29d2
Sanitized date-time to datetime
Nayanatharapmc Dec 17, 2024
5f0cb2f
Generated connector code using Ballerina OpenAPI tool
Nayanatharapmc Dec 17, 2024
ef94d97
Commented out java version
Nayanatharapmc Dec 18, 2024
26ecf05
Successfully built the repo
Nayanatharapmc Dec 20, 2024
211d320
Updated overview
Nayanatharapmc Dec 20, 2024
c7c60df
HubSpot URL added
Nayanatharapmc Dec 20, 2024
c8a40a2
Added the overview and setup guide
Nayanatharapmc Dec 20, 2024
1252c84
[Automated] Update the toml files
Nayanatharapmc Dec 22, 2024
de171ec
Passed the test case for getTickets()
Nayanatharapmc Dec 22, 2024
0574a6a
[Automated] Update the toml files
Nayanatharapmc Dec 23, 2024
e8f8206
[Automated] Update the toml files
Nayanatharapmc Dec 23, 2024
4dd69c7
Added test function to get ticket by Id
Nayanatharapmc Dec 23, 2024
8e68865
Updated test case to create a new ticket
Nayanatharapmc Dec 25, 2024
0b07e0d
[Automated] Update the toml files
Nayanatharapmc Dec 26, 2024
b082fc9
[Automated] Update the toml files
Nayanatharapmc Dec 26, 2024
710fc2c
Included test cases to check all the endponts
Nayanatharapmc Dec 26, 2024
34ab477
Updated package version
Nayanatharapmc Dec 26, 2024
24f4717
Updated readme
Nayanatharapmc Dec 27, 2024
907f88c
[Automated] Update the toml files
Nayanatharapmc Dec 27, 2024
3a8c37a
[Automated] Update the toml files
Nayanatharapmc Dec 27, 2024
d7e9c16
[Automated] Update the toml files
Nayanatharapmc Dec 27, 2024
02e2bba
[Automated] Update the toml files
Nayanatharapmc Dec 27, 2024
f070262
[Automated] Update the toml files
Nayanatharapmc Dec 27, 2024
1ce56f0
[Automated] Update the toml files
Nayanatharapmc Dec 27, 2024
abe9c5f
Updated Package.md
Nayanatharapmc Dec 27, 2024
7d47736
[Automated] Update the toml files
Nayanatharapmc Dec 27, 2024
8f16ea6
Updated tests
Nayanatharapmc Dec 28, 2024
7cbff24
[Automated] Update the toml files
Nayanatharapmc Jan 2, 2025
789388f
[Automated] Update the toml files
Nayanatharapmc Jan 2, 2025
8ce32fb
Updated tests
Nayanatharapmc Jan 2, 2025
978af67
Updated overview
Nayanatharapmc Jan 3, 2025
78cc3fe
Updated server URL and API paths in the OpenAPI spec
Nayanatharapmc Jan 3, 2025
05f782d
[Automated] Update the toml files
Nayanatharapmc Jan 3, 2025
089fc30
Regenerated client code
Nayanatharapmc Jan 3, 2025
faa6325
[Automated] Update the toml files
Nayanatharapmc Jan 5, 2025
ad2a778
[Automated] Update the toml files
Nayanatharapmc Jan 6, 2025
8e11c80
[Automated] Update the toml files
Nayanatharapmc Jan 6, 2025
318080e
[Automated] Update the toml files
Nayanatharapmc Jan 6, 2025
2db7205
[Automated] Update the toml files
Nayanatharapmc Jan 6, 2025
8c66075
[Automated] Update the toml files
Nayanatharapmc Jan 6, 2025
034e03e
[Automated] Update the toml files
Nayanatharapmc Jan 6, 2025
e475918
[Automated] Update the toml files
Nayanatharapmc Jan 6, 2025
4ab5f96
[Automated] Update the toml files
Nayanatharapmc Jan 6, 2025
c98bfcb
[Automated] Update the toml files
Nayanatharapmc Jan 6, 2025
ec206ad
[Automated] Update the toml files
Nayanatharapmc Jan 6, 2025
c9cfbdb
[Automated] Update the toml files
Nayanatharapmc Jan 6, 2025
6202eeb
[Automated] Update the toml files
Nayanatharapmc Jan 7, 2025
f95b301
[Automated] Update the toml files
Nayanatharapmc Jan 7, 2025
c740fb0
[Automated] Update the toml files
Nayanatharapmc Jan 7, 2025
0f7f121
[Automated] Update the toml files
Nayanatharapmc Jan 7, 2025
44d7d0e
Updated tests
Nayanatharapmc Jan 7, 2025
c8c8830
Updated Readme
Nayanatharapmc Jan 7, 2025
4a53e35
Regenerated client code including the WSO2 licensing header
Nayanatharapmc Jan 7, 2025
f94f416
Update README.md
Nayanatharapmc Jan 7, 2025
d2c587e
Update README.md
Nayanatharapmc Jan 7, 2025
cbdc5df
Added example weekly-ticket-reports
Nayanatharapmc Jan 9, 2025
404b55b
Added example 2 - Ticket management system
Nayanatharapmc Jan 9, 2025
11fc71b
Added readme.md for examples
Nayanatharapmc Jan 9, 2025
f67a284
Resolved commented issues
Nayanatharapmc Jan 9, 2025
6d408b6
Updated example readme files
Nayanatharapmc Jan 9, 2025
76b3a0a
Updated keywords
Nayanatharapmc Jan 9, 2025
e1c163a
Updated URL of examples
Nayanatharapmc Jan 9, 2025
fc7472e
Updated image paths
Nayanatharapmc Jan 9, 2025
bb1d5b0
Resolved commented issues
Nayanatharapmc Jan 9, 2025
b0d0d45
Resolved commented issues
Nayanatharapmc Jan 9, 2025
5d4e66e
Resolved commented issues
Nayanatharapmc Jan 9, 2025
c44c605
Formatted ballerina code
Nayanatharapmc Jan 9, 2025
4aa53bf
[Automated] Update the toml files
Nayanatharapmc Jan 10, 2025
3c2dc30
[Automated] Update the toml files
Nayanatharapmc Jan 10, 2025
3213f2e
Added hubspot icon
Nayanatharapmc Jan 10, 2025
7cfa799
Updated example package links in the documentation
Nayanatharapmc Jan 10, 2025
5fc6237
changed example path
Nayanatharapmc Jan 10, 2025
4a836a6
Added WSO2 license
Nayanatharapmc Jan 11, 2025
bbe229e
Update README.md
Nayanatharapmc Jan 17, 2025
7a176ca
Corrected scopes
Nayanatharapmc Jan 17, 2025
74ae006
Corrected scopes
Nayanatharapmc Jan 17, 2025
04cb2ee
Update examples/weekly-ticket-reports/Ballerina.toml
Nayanatharapmc Jan 18, 2025
224d164
Update examples/ticket-management-system/Ballerina.toml
Nayanatharapmc Jan 18, 2025
d7bfeae
[Automated] Update the toml files
Nayanatharapmc Jan 19, 2025
b9d00b5
[Automated] Update the toml files
Nayanatharapmc Jan 19, 2025
93a1e98
[Automated] Update the toml files
Nayanatharapmc Jan 19, 2025
b37ffab
[Automated] Update the toml files
Nayanatharapmc Jan 19, 2025
5a96467
[Automated] Update the toml files
Nayanatharapmc Jan 19, 2025
becec35
[Automated] Update the toml files
Nayanatharapmc Jan 19, 2025
981a2d1
[Automated] Update the toml files
Nayanatharapmc Jan 19, 2025
c131852
Added mock service and mock tests
Nayanatharapmc Jan 19, 2025
47cf102
renamed file
Nayanatharapmc Jan 19, 2025
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
Prev Previous commit
Next Next commit
Resolved commented issues
  • Loading branch information
Nayanatharapmc committed Jan 9, 2025
commit 5d4e66e4e43abf43f165bb795719d45b5fd90ba1
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -80,7 +80,6 @@ Before proceeding with the Quickstart, ensure you have obtained the Access Token

3. A code will be displayed in the browser. Copy that code.

Nayanatharapmc marked this conversation as resolved.
Show resolved Hide resolved

4. Run the following curl command. Replace the `<YOUR_CLIENT_ID>`, `<YOUR_REDIRECT_URI`> and `<YOUR_CLIENT_SECRET>` with your specific value. Use the code you received in the above step 3 as the `<CODE>`.

- Linux/macOS
@@ -114,8 +113,6 @@ Before proceeding with the Quickstart, ensure you have obtained the Access Token

5. Store the access token and refresh token securely for use in your application.



## Quickstart

To use the `HubSpot CRM Object Tickets` connector in your Ballerina application, update the `.bal` file as follows:
@@ -170,19 +167,16 @@ public function main() returns error? {
"subject": "New troubleshoot report"
}
};
hstickets:SimplePublicObject response = check HubSpotClient->/crm/v3/objects/tickets.post(payload);
hstickets:SimplePublicObject response = check HubSpotClient->/.post(payload);
io:println(response);
}

```

## Examples

The `HubSpot CRM Object Tickets` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.obj.tickets/tree/main/examples), covering the following use cases:
1. [Ticket Management System](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.tickets/tree/main/examples/ticket-management-system)
2. [Weekly Tickets Report Generation](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.tickets/tree/main/examples/weekly-ticket-reports)


1. [Ticket Management System](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.tickets/tree/main/examples/ticket-management-system) - Integrate HubSpot with multiple customer support channels to streamline ticket management.
2. [Weekly Tickets Report Generation](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.tickets/tree/main/examples/weekly-ticket-reports) - Analyze detailed summaries of customer tickets in each week for better support.

## Build from the source

8 changes: 3 additions & 5 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
@@ -72,7 +72,6 @@ Before proceeding with the Quickstart, ensure you have obtained the Access Token

3. A code will be displayed in the browser. Copy that code.

Nayanatharapmc marked this conversation as resolved.
Show resolved Hide resolved

4. Run the following curl command. Replace the `<YOUR_CLIENT_ID>`, `<YOUR_REDIRECT_URI`> and `<YOUR_CLIENT_SECRET>` with your specific value. Use the code you received in the above step 3 as the `<CODE>`.

- Linux/macOS
@@ -106,7 +105,6 @@ Before proceeding with the Quickstart, ensure you have obtained the Access Token

5. Store the access token and refresh token securely for use in your application.


## Quickstart

To use the `HubSpot CRM Object Tickets` connector in your Ballerina application, update the `.bal` file as follows:
@@ -161,13 +159,13 @@ public function main() returns error? {
"subject": "New troubleshoot report"
}
};
hstickets:SimplePublicObject response = check HubSpotClient->/crm/v3/objects/tickets.post(payload);
hstickets:SimplePublicObject response = check HubSpotClient->/.post(payload);
io:println(response);
}
```

## Examples

The `HubSpot CRM Object Tickets` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.obj.tickets/tree/main/examples), covering the following use cases:
1. [Ticket Management System](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.tickets/tree/main/examples/ticket-management-system)
2. [Weekly Tickets Report Generation](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.tickets/tree/main/examples/weekly-ticket-reports)
1. [Ticket Management System](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.tickets/tree/main/examples/ticket-management-system) - Integrate HubSpot with multiple customer support channels to streamline ticket management.
2. [Weekly Tickets Report Generation](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.tickets/tree/main/examples/weekly-ticket-reports) - Analyze detailed summaries of customer tickets in each week for better support.
10 changes: 3 additions & 7 deletions ballerina/Package.md
Nayanatharapmc marked this conversation as resolved.
Show resolved Hide resolved
Nayanatharapmc marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -72,7 +72,6 @@ Before proceeding with the Quickstart, ensure you have obtained the Access Token

3. A code will be displayed in the browser. Copy that code.


4. Run the following curl command. Replace the `<YOUR_CLIENT_ID>`, `<YOUR_REDIRECT_URI`> and `<YOUR_CLIENT_SECRET>` with your specific value. Use the code you received in the above step 3 as the `<CODE>`.

- Linux/macOS
@@ -106,8 +105,6 @@ Before proceeding with the Quickstart, ensure you have obtained the Access Token

5. Store the access token and refresh token securely for use in your application.



## Quickstart

To use the `HubSpot CRM Object Tickets` connector in your Ballerina application, update the `.bal` file as follows:
@@ -162,14 +159,13 @@ public function main() returns error? {
"subject": "New troubleshoot report"
}
};
hstickets:SimplePublicObject response = check HubSpotClient->/crm/v3/objects/tickets.post(payload);
hstickets:SimplePublicObject response = check HubSpotClient->/.post(payload);
io:println(response);
}
```

## Examples

The `HubSpot CRM Object Tickets` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.obj.tickets/tree/main/examples), covering the following use cases:
1. [Ticket Management System](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.tickets/tree/main/examples/ticket-management-system)
2. [Weekly Tickets Report Generation](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.tickets/tree/main/examples/weekly-ticket-reports)

1. [Ticket Management System](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.tickets/tree/main/examples/ticket-management-system) - Integrate HubSpot with multiple customer support channels to streamline ticket management.
2. [Weekly Tickets Report Generation](https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.object.tickets/tree/main/examples/weekly-ticket-reports) - Analyze detailed summaries of customer tickets in each week for better support.
3 changes: 1 addition & 2 deletions ballerina/tests/test.bal
Original file line number Diff line number Diff line change
@@ -33,8 +33,7 @@ OAuth2RefreshTokenGrantConfig auth = {
credentialBearer: oauth2:POST_BODY_BEARER
};

ConnectionConfig config = {auth};
final Client HubSpotClient = check new Client(config, "https://api.hubapi.com/crm/v3/objects/tickets");
final Client HubSpotClient = check new Client({auth});

// Test to get a list of all tickets
@test:Config {
2 changes: 1 addition & 1 deletion docs/spec/sanitations.md
Original file line number Diff line number Diff line change
@@ -30,5 +30,5 @@ These changes are done in order to improve the overall usability, and as workaro
The following command was used to generate the Ballerina client from the OpenAPI specification. The command should be executed from the repository root directory.

```bash
bal openapi -i docs/spec/openapi.json --mode client -o ballerina
bal openapi -i docs/spec/openapi.json --mode client --license docs/license.txt -o ballerina/
```
8 changes: 0 additions & 8 deletions examples/ticket-management-system/.devcontainer.json
Nayanatharapmc marked this conversation as resolved.
Outdated
Show resolved Hide resolved
Nayanatharapmc marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

11 changes: 0 additions & 11 deletions examples/ticket-management-system/.gitignore
Nayanatharapmc marked this conversation as resolved.
Outdated
Show resolved Hide resolved
Nayanatharapmc marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

6 changes: 0 additions & 6 deletions examples/ticket-management-system/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -5,11 +5,5 @@ version = "0.1.0"
distribution = "2201.10.3"
repository= "local"
Nayanatharapmc marked this conversation as resolved.
Show resolved Hide resolved

[[dependency]]
org = "ballerinax"
name = "hubspot.crm.obj.tickets"
version = "1.0.0"
repository = "local"

[build-options]
observabilityIncluded = true
18 changes: 0 additions & 18 deletions examples/ticket-management-system/README.md
Original file line number Diff line number Diff line change
@@ -26,21 +26,3 @@ Execute the following commands to build an example from the source:
```bash
bal run
```

## Building the examples with the local module

**Warning**: Due to the absence of support for reading local repositories for single Ballerina files, the Bala of the module is manually written to the central repository as a workaround. Consequently, the bash script may modify your local Ballerina repositories.

Execute the following commands to build all the examples against the changes you have made to the module locally:

* To build all the examples:

```bash
./build.sh build
```

* To run all the examples:

```bash
./build.sh run
```
16 changes: 8 additions & 8 deletions examples/ticket-management-system/main.bal
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ hstickets:OAuth2RefreshTokenGrantConfig auth = {
credentialBearer: oauth2:POST_BODY_BEARER
};

final hstickets:Client TicketClient = check new hstickets:Client({auth});
final hstickets:Client hubspot = check new ({auth});

public function main() returns error? {
// Ticket creation
@@ -32,12 +32,12 @@ public function main() returns error? {
"content": "This is a sample ticket created using Ballerina"
}
};
hstickets:SimplePublicObject createdTicket = check TicketClient->/.post(payload);
hstickets:SimplePublicObject createdTicket = check hubspot->/.post(payload);
io:println("Created Ticket:", createdTicket);
createdTicketId = createdTicket.id;

// Ticket read
hstickets:SimplePublicObjectWithAssociations readTicket = check TicketClient->/[createdTicketId].get();
hstickets:SimplePublicObjectWithAssociations readTicket = check hubspot->/[createdTicketId].get();
io:println("Read Ticket:", readTicket);

// Ticket update
@@ -50,11 +50,11 @@ public function main() returns error? {
"content": "This is a sample ticket updated using Ballerina"
}
};
hstickets:SimplePublicObject updatedTicket = check TicketClient->/[createdTicketId].patch(updatePayload);
hstickets:SimplePublicObject updatedTicket = check hubspot->/[createdTicketId].patch(updatePayload);
io:println("Updated Ticket:", updatedTicket);

// Ticket deletion
http:Response deletedResponse = check TicketClient->/[createdTicketId].delete();
http:Response deletedResponse = check hubspot->/[createdTicketId].delete();
io:println("Deleted Ticket:", deletedResponse);

// Batch ticket creation
@@ -89,7 +89,7 @@ public function main() returns error? {
}
]
};
hstickets:BatchResponseSimplePublicObject createdBatchResponse = check TicketClient->/batch/create.post(batchCreatePayload);
hstickets:BatchResponseSimplePublicObject createdBatchResponse = check hubspot->/batch/create.post(batchCreatePayload);
io:println("Created Batch Ticket Response:", createdBatchResponse);
batchTicketId1 = createdBatchResponse.results[0].id;
batchTicketId2 = createdBatchResponse.results[1].id;
@@ -102,7 +102,7 @@ public function main() returns error? {
"properties": ["subject", "hs_pipeline", "hs_pipeline_stage", "hs_ticket_priority", "content"],
"inputs": []
};
hstickets:BatchResponseSimplePublicObject batchReadResponse = check TicketClient->/batch/read.post(batchReadPayload);
hstickets:BatchResponseSimplePublicObject batchReadResponse = check hubspot->/batch/read.post(batchReadPayload);
io:println("Batch Read Ticket Response:", batchReadResponse);

// Batch ticket update
@@ -140,6 +140,6 @@ public function main() returns error? {
}
]
};
hstickets:BatchResponseSimplePublicObject batchUpdateResponse = check TicketClient->/batch/update.post(batchUpdatePayload);
hstickets:BatchResponseSimplePublicObject batchUpdateResponse = check hubspot->/batch/update.post(batchUpdatePayload);
io:println("Batch Update Ticket Response:", batchUpdateResponse);
}
8 changes: 0 additions & 8 deletions examples/weekly-ticket-reports/.devcontainer.json
Nayanatharapmc marked this conversation as resolved.
Outdated
Show resolved Hide resolved
Nayanatharapmc marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

11 changes: 0 additions & 11 deletions examples/weekly-ticket-reports/.gitignore
Nayanatharapmc marked this conversation as resolved.
Outdated
Show resolved Hide resolved
Nayanatharapmc marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

6 changes: 0 additions & 6 deletions examples/weekly-ticket-reports/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -5,11 +5,5 @@ version = "0.1.0"
distribution = "2201.10.3"
repository = "local"
Nayanatharapmc marked this conversation as resolved.
Show resolved Hide resolved

[[dependency]]
org = "ballerinax"
name = "hubspot.crm.obj.tickets"
version = "1.0.0"
repository = "local"

[build-options]
observabilityIncluded = true
19 changes: 1 addition & 18 deletions examples/weekly-ticket-reports/README.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ This use case demonstrates how the `HubSpot Tickets API` can be utilized to imp

## Prerequisites

For each example, create a `Config.toml` file in the example root directory. Here's an example of how your Config.toml file should look:
For each example, create a `Config.toml` file in the example root directory. Here's an example of how your `Config.toml` file should look:
```
clientId = "<clientId>"
clientSecret = "<clientSecret>"
@@ -27,20 +27,3 @@ Execute the following commands to build an example from the source:
bal run
```

## Building the examples with the local module

**Warning**: Due to the absence of support for reading local repositories for single Ballerina files, the Bala of the module is manually written to the central repository as a workaround. Consequently, the bash script may modify your local Ballerina repositories.

Execute the following commands to build all the examples against the changes you have made to the module locally:

* To build all the examples:

```bash
./build.sh build
```

* To run all the examples:

```bash
./build.sh run
```
2 changes: 1 addition & 1 deletion examples/weekly-ticket-reports/main.bal
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ hstickets:OAuth2RefreshTokenGrantConfig auth = {
credentialBearer: oauth2:POST_BODY_BEARER
};

final hstickets:Client TicketClient = check new hstickets:Client({auth});
final hstickets:Client TicketClient = check new ({auth});

public function main() returns error? {
hstickets:CollectionResponseSimplePublicObjectWithAssociationsForwardPaging ticketList = check TicketClient->/.get();