Skip to content

Commit 05da190

Browse files
authored
Merge pull request docusign#16 from docusign/new-click-sdk
adding Click examples back to the launcher
2 parents e7a7682 + cb35bf2 commit 05da190

7 files changed

Lines changed: 30 additions & 24 deletions

File tree

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
### Github repo: [code-examples-python](./)
44

5-
This GitHub repo includes code examples for both the DocuSign eSignature REST API as well as the DocuSign Rooms API. To use the Rooms API code example, modify the EXAMPLES_API_TYPE setting at the end of the ds_config.py file. Set 'Rooms' to True and 'ESignature' to False.
5+
This GitHub repo includes code examples for DocuSign APIs.
6+
7+
To switch between API code examples, modify the EXAMPLES_API_TYPE setting at the end of the configuration file. Set only one API type to true and set the remaining to false.
8+
9+
If none of the API types are set to true, the DocuSign eSignature REST API code examples will be shown. If multiple API types are set to true, only the first will be shown.
610

711
**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account).
812

@@ -153,7 +157,7 @@ This example adds a standard real estate related form to a specific room in your
153157
[Source.](./app/rooms/examples/eg005_get_rooms_with_filters/controller.py)
154158
1. **Create an external form fillable session.**
155159
[Source.](./app/rooms/examples/eg006_create_external_form_fill_session/controller.py)
156-
<!--
160+
157161
## Click API
158162

159163
1. **Create a clickwrap.**
@@ -170,7 +174,7 @@ This example demonstrates how to use DocuSign Click to get a list of clickwraps
170174
[Source.](./app/click/examples/eg006_list_clickwraps/controller.py)
171175
1. **Get clickwrap responses.**
172176
This example demonstrates how to use DocuSign Click to get user responses to your clickwrap agreements.
173-
[Source.](./app/click/examples/eg007_clickwrap_responses/controller.py) -->
177+
[Source.](./app/click/examples/eg007_clickwrap_responses/controller.py)
174178

175179
## Included OAuth grant types:
176180

app/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
from .docusign.views import ds
99
from .ds_config import EXAMPLES_API_TYPE
1010
from .rooms import examples as rooms_examples
11-
# from .click import examples as click_examples
11+
from .click import examples as click_examples
1212
from .views import core
1313

1414
session_path = "/tmp/python_recipe_sessions"
1515

1616
if EXAMPLES_API_TYPE["Rooms"]:
1717
app = Flask(__name__, template_folder='rooms/templates')
18-
# elif EXAMPLES_API_TYPE["Click"]:
19-
# app = Flask(__name__, template_folder='click/templates')
18+
elif EXAMPLES_API_TYPE["Click"]:
19+
app = Flask(__name__, template_folder='click/templates')
2020
else:
2121
app = Flask(__name__)
2222
app.config.from_pyfile("config.py")
@@ -43,12 +43,12 @@
4343
app.register_blueprint(rooms_examples.eg004)
4444
app.register_blueprint(rooms_examples.eg005)
4545
app.register_blueprint(rooms_examples.eg006)
46-
# elif EXAMPLES_API_TYPE["Click"]:
47-
# app.register_blueprint(click_examples.eg001)
48-
# app.register_blueprint(click_examples.eg002)
49-
# app.register_blueprint(click_examples.eg003)
50-
# app.register_blueprint(click_examples.eg004)
51-
# app.register_blueprint(click_examples.eg005)
46+
elif EXAMPLES_API_TYPE["Click"]:
47+
app.register_blueprint(click_examples.eg001)
48+
app.register_blueprint(click_examples.eg002)
49+
app.register_blueprint(click_examples.eg003)
50+
app.register_blueprint(click_examples.eg004)
51+
app.register_blueprint(click_examples.eg005)
5252
else:
5353
app.register_blueprint(examples.eg001)
5454
app.register_blueprint(examples.eg002)

app/click/examples/eg002_activate_clickwrap/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def worker(args):
3636
account_id=args["account_id"],
3737
clickwrap_id=args["clickwrap_id"],
3838
clickwrap_request=clickwrap_request,
39-
version_number="1"
39+
version_id="1"
4040
)
4141

4242
return response

app/docusign/ds_client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
"dtr.profile.write", "dtr.company.read", "dtr.company.write"
2222
]
2323

24-
# CLICK_SCOPES = [
25-
# "signature", "click.manage", "click.send"
26-
# ]
24+
CLICK_SCOPES = [
25+
"signature", "click.manage", "click.send"
26+
]
2727

2828

2929
class DSClient:
@@ -42,8 +42,8 @@ def _auth_code_grant(cls):
4242
oauth = OAuth(app)
4343
if EXAMPLES_API_TYPE["Rooms"]:
4444
use_scopes = ROOMS_SCOPES
45-
# elif EXAMPLES_API_TYPE["Click"]:
46-
# use_scopes = CLICK_SCOPES
45+
elif EXAMPLES_API_TYPE["Click"]:
46+
use_scopes = CLICK_SCOPES
4747
else:
4848
use_scopes = SCOPES
4949
request_token_params = {
@@ -72,8 +72,8 @@ def _jwt_auth(cls):
7272

7373
if EXAMPLES_API_TYPE["Rooms"]:
7474
use_scopes = ROOMS_SCOPES
75-
# elif EXAMPLES_API_TYPE["Click"]:
76-
# use_scopes = CLICK_SCOPES
75+
elif EXAMPLES_API_TYPE["Click"]:
76+
use_scopes = CLICK_SCOPES
7777
else:
7878
use_scopes = SCOPES
7979

app/ds_config_sample.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@
4242
EXAMPLES_API_TYPE = {
4343
"Rooms": False,
4444
"ESignature": True,
45+
"Click": False
4546
}

app/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ def index():
1414
return render_template(
1515
"home_rooms.html", title="Home - Python Rooms API Code Examples"
1616
)
17-
# elif EXAMPLES_API_TYPE["Click"]:
18-
# return render_template(
19-
# "home_click.html", title="Home - Python Click API Code Examples"
20-
# )
17+
elif EXAMPLES_API_TYPE["Click"]:
18+
return render_template(
19+
"home_click.html", title="Home - Python Click API Code Examples"
20+
)
2121
if DS_CONFIG["quickstart"] == "true":
2222
DS_CONFIG["quickstart"] = 'false'
2323
return redirect(url_for("eg001.get_view"))

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Click
66
cryptography==3.2.1
77
docusign-esign==3.6.0
88
docusign-rooms==1.0.0b1
9+
docusign-click==1.0.0
910
Flask==1.1.1
1011
Flask-OAuthlib
1112
flask-wtf==0.14.3

0 commit comments

Comments
 (0)