-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #697 from sachinira/sugarcrm
Add SugarCRM connector
- Loading branch information
Showing
10 changed files
with
8,554 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
target |
This file contains 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
license = ["Apache-2.0"] | ||
keywords = ["Sales & CRM", "Customer Relationship Management"] | ||
org = "ballerinax" | ||
name = "sugarcrm" | ||
icon = "icon.png" | ||
distribution = "2201.0.3" | ||
repository = "https://github.com/ballerina-platform/ballerinax-openapi-connectors" | ||
version = "1.0.0" | ||
authors = ["Ballerina"] |
This file contains 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 |
---|---|---|
@@ -0,0 +1,273 @@ | ||
# AUTO-GENERATED FILE. DO NOT MODIFY. | ||
|
||
# This file is auto-generated by Ballerina for managing dependency versions. | ||
# It should not be modified by hand. | ||
|
||
[ballerina] | ||
dependencies-toml-version = "2" | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "auth" | ||
version = "2.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "crypto"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.array"}, | ||
{org = "ballerina", name = "lang.string"}, | ||
{org = "ballerina", name = "log"}, | ||
{org = "ballerina", name = "regex"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "cache" | ||
version = "3.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "task"}, | ||
{org = "ballerina", name = "time"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "crypto" | ||
version = "2.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "time"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "file" | ||
version = "1.2.2" | ||
dependencies = [ | ||
{org = "ballerina", name = "io"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "log"}, | ||
{org = "ballerina", name = "os"}, | ||
{org = "ballerina", name = "regex"}, | ||
{org = "ballerina", name = "time"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "http" | ||
version = "2.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "auth"}, | ||
{org = "ballerina", name = "cache"}, | ||
{org = "ballerina", name = "crypto"}, | ||
{org = "ballerina", name = "file"}, | ||
{org = "ballerina", name = "io"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "jwt"}, | ||
{org = "ballerina", name = "lang.array"}, | ||
{org = "ballerina", name = "lang.decimal"}, | ||
{org = "ballerina", name = "lang.int"}, | ||
{org = "ballerina", name = "lang.runtime"}, | ||
{org = "ballerina", name = "lang.string"}, | ||
{org = "ballerina", name = "lang.value"}, | ||
{org = "ballerina", name = "log"}, | ||
{org = "ballerina", name = "mime"}, | ||
{org = "ballerina", name = "oauth2"}, | ||
{org = "ballerina", name = "observe"}, | ||
{org = "ballerina", name = "regex"}, | ||
{org = "ballerina", name = "time"}, | ||
{org = "ballerina", name = "url"} | ||
] | ||
modules = [ | ||
{org = "ballerina", packageName = "http", moduleName = "http"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "io" | ||
version = "1.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.value"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "jballerina.java" | ||
version = "0.0.0" | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "jwt" | ||
version = "2.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "cache"}, | ||
{org = "ballerina", name = "crypto"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.int"}, | ||
{org = "ballerina", name = "lang.string"}, | ||
{org = "ballerina", name = "log"}, | ||
{org = "ballerina", name = "regex"}, | ||
{org = "ballerina", name = "time"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.__internal" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.object"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.array" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.__internal"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.decimal" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.int" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.object" | ||
version = "0.0.0" | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.runtime" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.string" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.value" | ||
version = "0.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "log" | ||
version = "2.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "io"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.value"}, | ||
{org = "ballerina", name = "observe"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "mime" | ||
version = "2.2.2" | ||
dependencies = [ | ||
{org = "ballerina", name = "io"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.int"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "oauth2" | ||
version = "2.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "cache"}, | ||
{org = "ballerina", name = "crypto"}, | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "log"}, | ||
{org = "ballerina", name = "time"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "observe" | ||
version = "1.0.4" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "os" | ||
version = "1.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "regex" | ||
version = "1.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "task" | ||
version = "2.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "time"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "time" | ||
version = "2.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "url" | ||
version = "2.2.1" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
modules = [ | ||
{org = "ballerina", packageName = "url", moduleName = "url"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerinax" | ||
name = "sugarcrm" | ||
version = "1.0.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "http"}, | ||
{org = "ballerina", name = "url"} | ||
] | ||
modules = [ | ||
{org = "ballerinax", packageName = "sugarcrm", moduleName = "sugarcrm"} | ||
] | ||
|
||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
## Overview | ||
This is a generated connector for [SugarCRM REST API v12.0](https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_12.0/Integration/Web_Services/REST_API/) OpenAPI Specification. | ||
SugarCRM REST API provides capabilities to effectively manage the customer lifecycle with a set of modules that support each stage of the funnel. | ||
|
||
## Prerequisites | ||
|
||
Before using this connector in your Ballerina application, complete the following: | ||
|
||
* Create a [SugarCRM](https://www.sugarcrm.com/au/?utm_source=google.com&utm_medium=organic) account | ||
* Obtain tokens by following [this guide](https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_12.0/Integration/Web_Services/REST_API/#Authentication) | ||
|
||
## Quickstart | ||
|
||
To use the SugarCRM connector in your Ballerina application, update the .bal file as follows: | ||
|
||
### Step 1: Import connector | ||
First, import the `ballerinax/sugarcrm` module into the Ballerina project. | ||
```ballerina | ||
import ballerinax/sugarcrm; | ||
``` | ||
|
||
### Step 2: Create a new connector instance | ||
Create a `sugarcrm:ApiKeysConfig` with the API key obtained, and initialize the connector with it. | ||
```ballerina | ||
sugarcrm:ClientConfig config = { | ||
auth: { | ||
tokenUrl: "<TOKEN_URL>" | ||
username: "<USERNAME>" | ||
password: "<PASSWORD>" | ||
clientId: "<CLIENT_ID>" | ||
clientSecret: "<CLIENT_SECRET>" | ||
} | ||
} | ||
sugarcrm:Client sugarCrmClient = check new Client(config, serviceUrl = "https://<site_url>/rest/v{version}/"); | ||
``` | ||
|
||
### Step 3: Invoke connector operation | ||
1. Now you can use the operations available within the connector. Note that they are in the form of remote operations. | ||
|
||
Following is an example on how to list set of records filtered by an expression using the connector. | ||
|
||
Creates a ticket for the company | ||
|
||
```ballerina | ||
public function main() returns error? { | ||
string module = "Account"; | ||
string[] filter = [{"id":"1"}]; | ||
FilteredRecordDetails records = check sugarCrmClient -> listRecords(module, filter); | ||
io:println(records); | ||
} | ||
``` | ||
2. Use `bal run` command to compile and run the Ballerina program. |
This file contains 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Connects to [SugarCRM API](https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_12.0/Integration/Web_Services/REST_API/) from Ballerina | ||
|
||
## Package overview | ||
The `ballerinax/sugarcrm` is a [Ballerina](https://ballerina.io/) connector for SugarCRM API. | ||
This package provides the capability to access SugarCRM instance. | ||
|
||
### Compatibility | ||
| | Version | | ||
|-----------------------------|--------------------------------| | ||
| Ballerina Language | Ballerina Swan Lake 2201.0.3 | | ||
| SugarCRM API | v12.0 | | ||
|
||
## Report issues | ||
To report bugs, request new features, start new discussions, view project boards, etc., go to the [Ballerina Extended Library repository](https://github.com/ballerina-platform/ballerina-extended-library) | ||
|
||
## Useful links | ||
- Discuss code changes of the Ballerina project in [[email protected]](mailto:[email protected]). | ||
- Chat live with us via our [Slack channel](https://ballerina.io/community/slack/). | ||
- Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag |
Oops, something went wrong.