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

Apply review changes to the connector #5

Merged
merged 11 commits into from
Mar 14, 2024
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@
[![GitHub Issues](https://img.shields.io/github/issues/ballerina-platform/ballerina-library/module/docusign.dsclick.svg?label=Open%20Issues)](https://github.com/ballerina-platform/ballerina-library/labels/module%2Fdocusign.dsclick)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

The DocuSign Click connector can be used for simple agreements like terms & conditions and privacy policies, etc. It enables users to capture consent with just one click which simplifies the agreement process and enhances the user experience with this functionality. For more information about configuration and operations, refer to the module.
DocuSign is a digital transaction management platform that enables users to securely sign, send, and manage documents electronically.

- [docusign.dsclick](ballerina/Module.md) - Perform DocuSign Click related operations

## Overview

The Ballerina Docusign Click Connector provides the capability to capture user consent with one click for simple agreements such as terms & conditions and privacy policies

The Ballerina Docusign Click module supports [DocuSign Click API V2](https://github.com/docusign/OpenAPI-Specifications/blob/master/click.rest.swagger-v2.json).
The Ballerina DocuSign Click connector integrates with the DocuSign platform, provides APIs to capture user consent with one click for simple agreements such as terms & conditions and privacy policies within Ballerina applications. It supports [DocuSign Click API V2](https://github.com/docusign/OpenAPI-Specifications/blob/master/click.rest.swagger-v2.json).

## Setup guide

Expand Down
4 changes: 2 additions & 2 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
distribution = "2201.8.4"
org = "ballerinax"
name = "docusign.dsclick"
version = "1.0.0"
version = "2.0.0"
license = ["Apache-2.0"]
authors = ["Ballerina"]
keywords = ["eSignature", "Cost/Freemium", "Documents", "Collaboration", "Digital Signature"]
keywords = ["eSignature", "Cost/Freemium", "Documents", "Click API", "Collaboration", "Digital Signature"]
icon = "icon.png"
repository = "https://github.com/ballerina-platform/module-ballerinax-docusign.dsclick"

Expand Down
4 changes: 2 additions & 2 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.8"
version = "2.10.11"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "cache"},
Expand Down Expand Up @@ -308,7 +308,7 @@ modules = [
[[package]]
org = "ballerinax"
name = "docusign.dsclick"
version = "1.0.0"
version = "2.0.0"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
Expand Down
4 changes: 2 additions & 2 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Overview

The Ballerina Docusign Click Connector provides the capability to capture user consent with one click for simple agreements such as terms & conditions and privacy policies
DocuSign is a digital transaction management platform that enables users to securely sign, send, and manage documents electronically.

The Ballerina Docusign Click module supports [DocuSign Click API V2](https://github.com/docusign/OpenAPI-Specifications/blob/master/click.rest.swagger-v2.json).
The Ballerina DocuSign Click connector integrates with the DocuSign platform, provides APIs to capture user consent with one click for simple agreements such as terms & conditions and privacy policies within Ballerina applications. It supports [DocuSign Click API V2](https://github.com/docusign/OpenAPI-Specifications/blob/master/click.rest.swagger-v2.json).

## Setup guide

Expand Down
4 changes: 2 additions & 2 deletions ballerina/Package.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Package overview

The Ballerina Docusign Click Connector provides the capability to capture user consent with one click for simple agreements such as terms & conditions and privacy policies
DocuSign is a digital transaction management platform that enables users to securely sign, send, and manage documents electronically.

The Ballerina Docusign Click module supports [DocuSign Click API V2](https://github.com/docusign/OpenAPI-Specifications/blob/master/click.rest.swagger-v2.json).
The Ballerina DocuSign Click connector integrates with the DocuSign platform, provides APIs to capture user consent with one click for simple agreements such as terms & conditions and privacy policies within Ballerina applications. It supports [DocuSign Click API V2](https://github.com/docusign/OpenAPI-Specifications/blob/master/click.rest.swagger-v2.json).

## Setup guide

Expand Down
26 changes: 13 additions & 13 deletions ballerina/client.bal
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public isolated client class Client {
# + config - The configurations to be used when initializing the `connector`
# + serviceUrl - URL of the target service
# + return - An error if connector initialization failed
public isolated function init(ConnectionConfig config = {}, string serviceUrl = "https://demo.docusign.net/clickapi") returns error? {
public isolated function init(string serviceUrl, *ConnectionConfig config) returns error? {
http:ClientConfiguration httpClientConfig = {httpVersion: config.httpVersion, timeout: config.timeout, forwarded: config.forwarded, poolConfig: config.poolConfig, compression: config.compression, circuitBreaker: config.circuitBreaker, retryConfig: config.retryConfig, validation: config.validation};
do {
if config.auth is http:ClientAuthConfig {
Expand Down Expand Up @@ -301,10 +301,10 @@ public isolated client class Client {
# the **API and Keys** page in
# eSignature Settings.
# + clickwrapId - The ID of the clickwrap.
# + versionId - The ID of the version.
# + version - The version ID or the version number
# + return - A successful response or an error.
resource isolated function get v1/accounts/[string accountId]/clickwraps/[string clickwrapId]/versions/[string versionId]() returns ClickwrapVersionResponse|error {
string resourcePath = string `/v1/accounts/${getEncodedUri(accountId)}/clickwraps/${getEncodedUri(clickwrapId)}/versions/${getEncodedUri(versionId)}`;
resource isolated function get v1/accounts/[string accountId]/clickwraps/[string clickwrapId]/versions/[string version]() returns ClickwrapVersionResponse|error {
string resourcePath = string `/v1/accounts/${getEncodedUri(accountId)}/clickwraps/${getEncodedUri(clickwrapId)}/versions/${getEncodedUri(version)}`;
ClickwrapVersionResponse response = check self.clientEp->get(resourcePath);
return response;
}
Expand All @@ -318,10 +318,10 @@ public isolated client class Client {
# the **API and Keys** page in
# eSignature Settings.
# + clickwrapId - The ID of the clickwrap.
# + versionId - The ID of the version.
# + version - The version ID or the version number
# + return - A successful response or an error.
resource isolated function put v1/accounts/[string accountId]/clickwraps/[string clickwrapId]/versions/[string versionId](ClickwrapRequest payload) returns ClickwrapVersionSummaryResponse|error {
string resourcePath = string `/v1/accounts/${getEncodedUri(accountId)}/clickwraps/${getEncodedUri(clickwrapId)}/versions/${getEncodedUri(versionId)}`;
resource isolated function put v1/accounts/[string accountId]/clickwraps/[string clickwrapId]/versions/[string version](ClickwrapRequest payload) returns ClickwrapVersionSummaryResponse|error {
string resourcePath = string `/v1/accounts/${getEncodedUri(accountId)}/clickwraps/${getEncodedUri(clickwrapId)}/versions/${getEncodedUri(version)}`;
http:Request request = new;
json jsonBody = payload.toJson();
request.setPayload(jsonBody, "application/json");
Expand All @@ -338,10 +338,10 @@ public isolated client class Client {
# the **API and Keys** page in
# eSignature Settings.
# + clickwrapId - The ID of the clickwrap.
# + versionId - The ID of the version.
# + version - The version ID or the version number
# + return - A successful response or an error.
resource isolated function delete v1/accounts/[string accountId]/clickwraps/[string clickwrapId]/versions/[string versionId]() returns ClickwrapVersionDeleteResponse|error {
string resourcePath = string `/v1/accounts/${getEncodedUri(accountId)}/clickwraps/${getEncodedUri(clickwrapId)}/versions/${getEncodedUri(versionId)}`;
resource isolated function delete v1/accounts/[string accountId]/clickwraps/[string clickwrapId]/versions/[string version]() returns ClickwrapVersionDeleteResponse|error {
string resourcePath = string `/v1/accounts/${getEncodedUri(accountId)}/clickwraps/${getEncodedUri(clickwrapId)}/versions/${getEncodedUri(version)}`;
ClickwrapVersionDeleteResponse response = check self.clientEp->delete(resourcePath);
return response;
}
Expand All @@ -355,7 +355,7 @@ public isolated client class Client {
# the **API and Keys** page in
# eSignature Settings.
# + clickwrapId - The ID of the clickwrap.
# + versionId - The ID of the version.
# + version - The version ID of the version number
# + from_date - Optional. The earliest date to return agreements from.
# + page_number - Optional. The page number to return.
# + status - Clickwrap status. Possible values:
Expand All @@ -364,8 +364,8 @@ public isolated client class Client {
# - `deleted`
# + to_date - Optional. The latest date to return agreements from.
# + return - A successful response or an error.
resource isolated function get v1/accounts/[string accountId]/clickwraps/[string clickwrapId]/versions/[string versionId]/users(string? client_user_id = (), string? from_date = (), string? page_number = (), string? status = (), string? to_date = ()) returns ClickwrapAgreementsResponse|error {
string resourcePath = string `/v1/accounts/${getEncodedUri(accountId)}/clickwraps/${getEncodedUri(clickwrapId)}/versions/${getEncodedUri(versionId)}/users`;
resource isolated function get v1/accounts/[string accountId]/clickwraps/[string clickwrapId]/versions/[string version]/users(string? client_user_id = (), string? from_date = (), string? page_number = (), string? status = (), string? to_date = ()) returns ClickwrapAgreementsResponse|error {
string resourcePath = string `/v1/accounts/${getEncodedUri(accountId)}/clickwraps/${getEncodedUri(clickwrapId)}/versions/${getEncodedUri(version)}/users`;
map<anydata> queryParam = {"client_user_id": client_user_id, "from_date": from_date, "page_number": page_number, "status": status, "to_date": to_date};
resourcePath = resourcePath + check getPathForQueryParam(queryParam);
ClickwrapAgreementsResponse response = check self.clientEp->get(resourcePath);
Expand Down
10 changes: 4 additions & 6 deletions ballerina/tests/click-test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ configurable string userId = ?;
@test:BeforeSuite
function initializeClientsForDocuSignServer() returns error? {
if isTestOnLiveServer {
docuSignClient = check new(
docuSignClient = check new("https://demo.docusign.net/clickapi/",
{
timeout: 10000,
auth: {
Expand All @@ -42,11 +42,10 @@ function initializeClientsForDocuSignServer() returns error? {
refreshToken: os:getEnv("REFRESH_TOKEN"),
refreshUrl: os:getEnv("REFRESH_URL")
}
},
serviceUrl = "https://demo.docusign.net/clickapi/"
}
);
} else {
docuSignClient = check new(
docuSignClient = check new("http://localhost:9092/clickapi",
{
timeout: 10000,
auth: {
Expand All @@ -55,8 +54,7 @@ function initializeClientsForDocuSignServer() returns error? {
refreshToken,
refreshUrl
}
},
serviceUrl = "http://localhost:9092/clickapi"
}
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion build-config/resources/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = "docusign.dsclick"
version = "@toml.version@"
license = ["Apache-2.0"]
authors = ["Ballerina"]
keywords = ["eSignature", "Cost/Freemium", "Documents", "Collaboration", "Digital Signature"]
keywords = ["eSignature", "Cost/Freemium", "Documents", "Click API", "Collaboration", "Digital Signature"]
icon = "icon.png"
repository = "https://github.com/ballerina-platform/module-ballerinax-docusign.dsclick"

Expand Down
Loading
Loading