-
Notifications
You must be signed in to change notification settings - Fork 2
Implement suggested changes #5
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
Merged
MohamedSabthar
merged 3 commits into
ballerina-platform:main
from
CharanaManawathilake:main
Jan 17, 2025
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,9 +27,9 @@ configurable string clientSecret = ?; | |||||||||||||||||||||||
| configurable string refreshToken = ?; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| crmImport:OAuth2RefreshTokenGrantConfig auth = { | ||||||||||||||||||||||||
| clientId: clientId, | ||||||||||||||||||||||||
| clientSecret: clientSecret, | ||||||||||||||||||||||||
| refreshToken: refreshToken, | ||||||||||||||||||||||||
| clientId, | ||||||||||||||||||||||||
| clientSecret, | ||||||||||||||||||||||||
| refreshToken, | ||||||||||||||||||||||||
| credentialBearer: oauth2:POST_BODY_BEARER | ||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -38,8 +38,7 @@ final crmImport:Client importClient = check new ({auth}); | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public function main() returns error? { | ||||||||||||||||||||||||
| // Create an import request body | ||||||||||||||||||||||||
| json readJson = check io:fileReadJson("resources/contact_import_request.json"); | ||||||||||||||||||||||||
| string importRequestString = readJson.toString(); | ||||||||||||||||||||||||
| string importRequestString = check io:fileReadString("resources/contact_import_request.json"); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // Loading the data file | ||||||||||||||||||||||||
| string filePath = "resources/contact_import_file.csv"; | ||||||||||||||||||||||||
|
|
@@ -60,7 +59,7 @@ public function main() returns error? { | |||||||||||||||||||||||
| io:println("The import is in the state : " + response.state); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // Check if the import is successful | ||||||||||||||||||||||||
| if response.id == null { | ||||||||||||||||||||||||
| if response.id is () { | ||||||||||||||||||||||||
| return error("The import is not successful"); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -69,7 +68,7 @@ public function main() returns error? { | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // Fetching the status of this import | ||||||||||||||||||||||||
| io:println("\nFetching the status of the import " + responseId.toString() + "..."); | ||||||||||||||||||||||||
| crmImport:PublicImportResponse|error statusResponse = importClient->/[responseId].get({}); | ||||||||||||||||||||||||
| crmImport:PublicImportResponse|error statusResponse = importClient->/[responseId].get(); | ||||||||||||||||||||||||
| if statusResponse is error { | ||||||||||||||||||||||||
| io:println("Failed to fetch the status of the import"); | ||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||
|
|
@@ -80,14 +79,15 @@ public function main() returns error? { | |||||||||||||||||||||||
| // Cancel the import | ||||||||||||||||||||||||
| io:println("\nCanceling the import " + responseId.toString() + "..."); | ||||||||||||||||||||||||
| crmImport:ActionResponse|error cancelResponse = importClient->/[responseId]/cancel.post(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if cancelResponse is error { | ||||||||||||||||||||||||
| io:println("Failed to cancel the import"); | ||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||
| if cancelResponse.status == "COMPLETE" { | ||||||||||||||||||||||||
| io:println("The import was cancelled successfully"); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| else { | ||||||||||||||||||||||||
| io:println("The import cancellation is in the state : " + cancelResponse.status); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| return io:println("Failed to cancel the import"); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if cancelResponse.status == "COMPLETE" { | ||||||||||||||||||||||||
| io:println("The import was cancelled successfully"); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| else { | ||||||||||||||||||||||||
| io:println("The import cancellation is in the state : " + cancelResponse.status); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| if cancelResponse.status == "COMPLETE" { | |
| io:println("The import was cancelled successfully"); | |
| } | |
| else { | |
| io:println("The import cancellation is in the state : " + cancelResponse.status); | |
| } | |
| if cancelResponse.status == "COMPLETE" { | |
| io:println("The import was cancelled successfully"); | |
| return; | |
| } | |
| io:println("The import cancellation is in the state : " + cancelResponse.status); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.