Skip to content

Commit

Permalink
Merge pull request #17 from Nuvindu/documentation
Browse files Browse the repository at this point in the history
Update documentation in the standard format
  • Loading branch information
Nuvindu authored Mar 6, 2024
2 parents ed61dc6 + d3f6830 commit 13cd9d8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 26 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,31 @@ In order to use the DocuSign eSignature connector, you need to first create the

### Step 2: Create integration key and secret key

1. **Create an integration key**: Visit the [Apps and Keys](https://admindemo.docusign.com/apps-and-keys) page on DocuSign. Click on "Add App and Integration Key", provide an App name, and click "Create App". This will generate an Integration Key.
1. **Create an integration key**: Visit the [Apps and Keys](https://admindemo.docusign.com/apps-and-keys) page on DocuSign. Click on `Add App and Integration Key,` provide a name for the app, and click `Create App`. This will generate an `Integration Key`.

<img src="https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-docusign/main/ballerina/resources/app-and-integration-key.png" alt="Create Integration Key" width="50%">

2. **Generate a secret key**: Under the "Authentication" section, click on "Add Secret Key". This will generate a secret Key. Make sure to copy and save both the `Integration Key` and `Secret Key.`
2. **Generate a secret key**: Under the `Authentication` section, click on `Add Secret Key`. This will generate a secret Key. Make sure to copy and save both the `Integration Key` and `Secret Key`.

<img src="https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-docusign/main/ballerina/resources/add-secret-key.png" alt="Add Secret Key" width="50%">

### Step 3: Generate refresh token

1. **Add a redirect URI**: Click on "Add URI" and enter your redirect URI (e.g., <http://www.example.com/callback>).
1. **Add a redirect URI**: Click on `Add URI` and enter your redirect URI (e.g., <http://www.example.com/callback>).

<img src="https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-docusign/main/ballerina/resources/add-redirect-uri.png" alt="Add Redirect URI" width="50%">

2. **Generate the encoded key**: The `Encoded Key` is a base64 encoded string of your `Integration key` and `Secret Key` in the format `{IntegrationKey:SecretKey}`. You can generate this in your web browser's console using the `btoa()` function: `btoa('IntegrationKey:SecretKey')`. You can either generate the encoded key from an online base64 encoder.

3. **Get the authorization code**: Visit the following URL in your web browser, replacing `{iKey}` with your Integration Key and `{redirectUri}` with your Redirect URI:
3. **Get the authorization code**: Visit the following URL in your web browser, replacing `{iKey}` with your Integration Key and `{redirectUri}` with your redirect URI.

```url
https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature%20impersonation&client_id={iKey}&redirect_uri={redirectUri}
```

This will redirect you to your Redirect URI with a `code` query parameter. This is your authorization code.
This will redirect you to your Redirect URI with a `code` query parameter. This is your `authorization code`.

4. **Get the refresh token**: Use the following `curl` command to get the refresh token, replacing `{encodedKey}` with your Encoded Key and `{codeFromUrl}` with your authorization code:
4. **Get the refresh token**: Use the following `curl` command to get the refresh token, replacing `{encodedKey}` with your Encoded Key and `{codeFromUrl}` with your `authorization code`.

```bash
curl --location 'https://account-d.docusign.com/oauth/token' \
Expand All @@ -73,7 +73,7 @@ Above is about using the DocuSign eSignature APIs in the developer mode. If your

## Quickstart

This sample demonstrates a scenario of creating an envelope with a document and sending it to respective recipients to add the e-signature using the Ballerina DocuSign eSignature connector.
To use the DocuSign eSignature connector in your Ballerina project, modify the `.bal` file as follows.

### Step 1: Import the module

Expand All @@ -88,6 +88,11 @@ import ballerinax/docusign.dsesign;
Create a `dsesign:ConnectionConfig` with the obtained OAuth2.0 tokens and initialize the connector with it.

```ballerina
configurable string clientId = ?;
configurable string clientSecret = ?;
configurable string refreshToken = ?;
configurable string refreshUrl = ?;
dsesign:Client docusignClient = check new({
auth: {
clientId,
Expand All @@ -104,7 +109,6 @@ You can now utilize the operations available within the connector.

```ballerina
public function main() returns error? {
dsesign:Client docusignClient = ...//; initializes the DocuSign eSignature client
// Creates an envelope
dsesign:EnvelopeSummary newEnvelope = check docusignClient->/accounts/[accountId]/envelopes.post({
Expand Down
20 changes: 12 additions & 8 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ In order to use the DocuSign eSignature connector, you need to first create the

### Step 2: Create integration key and secret key

1. **Create an integration key**: Visit the [Apps and Keys](https://admindemo.docusign.com/apps-and-keys) page on DocuSign. Click on "Add App and Integration Key", provide an App name, and click "Create App". This will generate an `Integration Key`.
1. **Create an integration key**: Visit the [Apps and Keys](https://admindemo.docusign.com/apps-and-keys) page on DocuSign. Click on `Add App and Integration Key,` provide a name for the app, and click `Create App`. This will generate an `Integration Key`.

![Create integration key](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-docusign/main/ballerina/resources/app-and-integration-key.png)

2. **Generate a secret key**: Under the "Authentication" section, click on "Add Secret Key". This will generate a secret Key. Make sure to copy and save both the `Integration Key` and `Secret Key.`
2. **Generate a secret key**: Under the `Authentication` section, click on `Add Secret Key`. This will generate a secret Key. Make sure to copy and save both the `Integration Key` and `Secret Key`.

![Add secret key](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-docusign/main/ballerina/resources/add-secret-key.png)

### Step 3: Generate refresh token

1. **Add a redirect URI**: Click on "Add URI" and enter your redirect URI (e.g., <http://www.example.com/callback>).
1. **Add a redirect URI**: Click on `Add URI` and enter your redirect URI (e.g., <http://www.example.com/callback>).

![Add redirect URI](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-docusign/main/ballerina/resources/add-redirect-uri.png)

2. **Generate the encoded key**: The `Encoded Key` is a base64 encoded string of your `Integration key` and `Secret Key` in the format `{IntegrationKey:SecretKey}`. You can generate this in your web browser's console using the `btoa()` function: `btoa('IntegrationKey:SecretKey')`. You can either generate the encoded key from an online base64 encoder.

3. **Get the authorization code**: Visit the following URL in your web browser, replacing `{iKey}` with your Integration Key and `{redirectUri}` with your Redirect URI:
3. **Get the authorization code**: Visit the following URL in your web browser, replacing `{iKey}` with your Integration Key and `{redirectUri}` with your redirect URI.

```url
https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature%20impersonation&client_id={iKey}&redirect_uri={redirectUri}
```

This will redirect you to your Redirect URI with a `code` query parameter. This is your Authorization Code.
This will redirect you to your Redirect URI with a `code` query parameter. This is your `authorization code`.

4. **Get the refresh token**: Use the following `curl` command to get the refresh token, replacing `{encodedKey}` with your Encoded Key and `{codeFromUrl}` with your authorization code:
4. **Get the refresh token**: Use the following `curl` command to get the refresh token, replacing `{encodedKey}` with your Encoded Key and `{codeFromUrl}` with your `authorization code`.

```bash
curl --location 'https://account-d.docusign.com/oauth/token' \
Expand All @@ -60,7 +60,7 @@ Above is about using the DocuSign eSignature APIs in the developer mode. If your

## Quickstart

This sample demonstrates a scenario of creating an envelope with a document and sending it to respective recipients to add the e-signature using the Ballerina DocuSign eSignature connector.
To use the DocuSign eSignature connector in your Ballerina project, modify the `.bal` file as follows.

### Step 1: Import the module

Expand All @@ -75,6 +75,11 @@ import ballerinax/docusign.dsesign;
Create a `dsesign:ConnectionConfig` with the obtained OAuth2.0 tokens and initialize the connector with it.

```ballerina
configurable string clientId = ?;
configurable string clientSecret = ?;
configurable string refreshToken = ?;
configurable string refreshUrl = ?;
dsesign:Client docusignClient = check new({
auth: {
clientId,
Expand All @@ -92,7 +97,6 @@ You can now utilize the operations available within the connector.

```ballerina
public function main() returns error? {
dsesign:Client docusignClient = ...//; initializes the DocuSign eSignature client
// Creates an envelope
dsesign:EnvelopeSummary newEnvelope = check docusignClient->/accounts/[accountId]/envelopes.post({
Expand Down
22 changes: 13 additions & 9 deletions ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ In order to use the DocuSign eSignature connector, you need to first create the

### Step 2: Create integration key and secret key

1. **Create an integration key**: Visit the [Apps and Keys](https://admindemo.docusign.com/apps-and-keys) page on DocuSign. Click on "Add App and Integration Key", provide an App name, and click "Create App". This will generate an Integration Key.
1. **Create an integration key**: Visit the [Apps and Keys](https://admindemo.docusign.com/apps-and-keys) page on DocuSign. Click on `Add App and Integration Key,` provide a name for the app, and click `Create App`. This will generate an `Integration Key`.

![Create integration key](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-docusign/main/ballerina/resources/app-and-integration-key.png)

2. **Generate a secret key**: Under the "Authentication" section, click on "Add Secret Key". This will generate a secret Key. Make sure to copy and save both the `Integration Key` and `Secret Key.`
2. **Generate a secret key**: Under the `Authentication` section, click on `Add Secret Key`. This will generate a secret Key. Make sure to copy and save both the `Integration Key` and `Secret Key`.

![Add secret key](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-docusign/main/ballerina/resources/add-secret-key.png)

### Step 3: Generate refresh token

1. **Add a redirect URI**: Click on "Add URI" and enter your redirect URI (e.g., <http://www.example.com/callback>).
1. **Add a redirect URI**: Click on `Add URI` and enter your redirect URI (e.g., <http://www.example.com/callback>).

![Add redirect URI](https://raw.githubusercontent.com/ballerina-platform/module-ballerinax-docusign/main/ballerina/resources/add-redirect-uri.png)

2. **Generate the encoded key**: The `Encoded Key` is a base64 encoded string of your `Integration key` and `Secret Key` in the format `{IntegrationKey:SecretKey}`. You can generate this in your web browser's console using the `btoa()` function: `btoa('IntegrationKey:SecretKey')`. You can either generate the encoded key from an online base64 encoder.

3. **Get the authorization code**: Visit the following URL in your web browser, replacing `{iKey}` with your Integration Key and `{redirectUri}` with your Redirect URI:
3. **Get the authorization code**: Visit the following URL in your web browser, replacing `{iKey}` with your Integration Key and `{redirectUri}` with your redirect URI.

```url
https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature%20impersonation&client_id={iKey}&redirect_uri={redirectUri}
```

This will redirect you to your Redirect URI with a `code` query parameter. This is your Authorization Code.
This will redirect you to your Redirect URI with a `code` query parameter. This is your `authorization code`.

4. **Get the refresh token**: Use the following `curl` command to get the refresh token, replacing `{encodedKey}` with your Encoded Key and `{codeFromUrl}` with your authorization code:
4. **Get the refresh token**: Use the following `curl` command to get the refresh token, replacing `{encodedKey}` with your Encoded Key and `{codeFromUrl}` with your `authorization code`.

```bash
curl --location 'https://account-d.docusign.com/oauth/token' \
Expand All @@ -60,7 +60,7 @@ Above is about using the DocuSign eSignature APIs in the developer mode. If your

## Quickstart

This sample demonstrates a scenario of creating an envelope with a document and sending it to respective recipients to add the e-signature using the Ballerina DocuSign eSignature connector.
To use the DocuSign eSignature connector in your Ballerina project, modify the `.bal` file as follows.

### Step 1: Import the module

Expand All @@ -72,9 +72,14 @@ import ballerinax/docusign.dsesign;

### Step 2: Instantiate a new connector

Create a `dsesign:ConnectionConfig` with the obtained OAuth2.0 tokens and initialize the connector with it.
Create a `dsesign:ConnectionConfig` with the obtained OAuth2.0 tokens and initialize the connector with it. Use `Integration Key` as the `clientId`.

```ballerina
configurable string clientId = ?;
configurable string clientSecret = ?;
configurable string refreshToken = ?;
configurable string refreshUrl = ?;
dsesign:Client docusignClient = check new({
auth: {
clientId,
Expand All @@ -92,7 +97,6 @@ You can now utilize the operations available within the connector.

```ballerina
public function main() returns error? {
dsesign:Client docusignClient = ...//; initializes the DocuSign eSignature client
// Creates an envelope
dsesign:EnvelopeSummary newEnvelope = check docusignClient->/accounts/[accountId]/envelopes.post({
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.caching=true
group=io.ballerina.stdlib
group=io.ballerina.lib
version=1.0.0-SNAPSHOT

checkstylePluginVersion=10.12.0
Expand Down

0 comments on commit 13cd9d8

Please sign in to comment.