+
+
From 3cfd8e0922e1836c3a7a076142959bd70d4c5385 Mon Sep 17 00:00:00 2001
From: Vladyslav Turchynevych
Date: Tue, 29 Dec 2020 10:26:41 +0200
Subject: [PATCH 08/17] added mandaroty param
---
.../examples/eg009_assign_form_to_form_group/controller.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/rooms/examples/eg009_assign_form_to_form_group/controller.py b/app/rooms/examples/eg009_assign_form_to_form_group/controller.py
index 829f7117..cdb7dc19 100644
--- a/app/rooms/examples/eg009_assign_form_to_form_group/controller.py
+++ b/app/rooms/examples/eg009_assign_form_to_form_group/controller.py
@@ -83,7 +83,8 @@ def worker(args) -> FormGroupFormToAssign:
form_groups_api = FormGroupsApi(api_client)
# Step 2. Create FormGroupFormToAssign Object
- form_group_to_assign = FormGroupFormToAssign(form_id=args["form_id"])
+ form_group_to_assign = FormGroupFormToAssign(form_id=args["form_id"],
+ is_required=True)
# Step 3. Grant office access tp a form group via FormGroups API
response = form_groups_api.assign_form_group_form(
From fef8ffb55c540e73058769a5bc9312c91898886d Mon Sep 17 00:00:00 2001
From: Vladyslav Turchynevych
Date: Mon, 4 Jan 2021 11:30:07 +0200
Subject: [PATCH 09/17] review fixes
---
README.md | 17 +++++++++-
.../eg007_create_form_group/controller.py | 8 ++---
.../controller.py | 27 ++++++---------
.../views.py | 1 -
.../controller.py | 34 ++++++++-----------
.../eg009_assign_form_to_form_group/views.py | 4 +--
requirements.txt | 1 -
7 files changed, 45 insertions(+), 47 deletions(-)
diff --git a/README.md b/README.md
index 17e55eee..e9e062c7 100644
--- a/README.md
+++ b/README.md
@@ -148,9 +148,24 @@ This example exports all the available data from a specific room in your DocuSig
This example adds a standard real estate related form to a specific room in your DocuSign Rooms account.
1. **How to search for rooms with filters.**
[Source.](./app/rooms/examples/eg005_get_rooms_with_filters/controller.py)
+This example demonstrates how to return rooms that have had their field data,
+updated within the time period between Start date and End date.
1. **Create an external form fillable session.**
[Source.](./app/rooms/examples/eg006_create_external_form_fill_session/controller.py)
-
+This example demonstrates how to create an
+external form fill session
+using the Rooms API:
+the result of this code example is the URL for the form fill session, which you can embed
+in your integration or send to the user.
+1. **Create a form group**
+[Source.](./app/rooms/examples/eg007_create_form_group/controller.py)
+This example demonstrates creating a DocuSign Form Group.
+1. **Grant office access to a form group**
+[Source.](./app/rooms/examples/eg008_grant_office_access_to_form_group/controller.py)
+This example demonstrates how to grant Office access to a Form Group.
+1. **Assign a form to a form group**
+[Source.](./app/rooms/examples/eg009_assign_form_to_form_group/controller.py)
+This example demonstrates how to assign form to a form group.
## Included OAuth grant types:
diff --git a/app/rooms/examples/eg007_create_form_group/controller.py b/app/rooms/examples/eg007_create_form_group/controller.py
index 0b359de0..f2548da8 100644
--- a/app/rooms/examples/eg007_create_form_group/controller.py
+++ b/app/rooms/examples/eg007_create_form_group/controller.py
@@ -1,7 +1,7 @@
+from docusign_rooms import FormGroupForCreate, FormGroupsApi
from flask import session, request
from app.rooms import create_rooms_api_client
-from docusign_rooms import FormGroupForCreate, FormGroupsApi
class Eg007Controller:
@@ -9,10 +9,8 @@ class Eg007Controller:
def get_args():
"""Get required session and request arguments"""
return {
- "account_id": session["ds_account_id"],
- # Represents your {ACCOUNT_ID}
- "access_token": session["ds_access_token"],
- # Represents your {ACCESS_TOKEN}
+ "account_id": session["ds_account_id"], # Represents your {ACCOUNT_ID}
+ "access_token": session["ds_access_token"], # Represents your {ACCESS_TOKEN}
"form_group_name": request.form.get("form_group_name"),
}
diff --git a/app/rooms/examples/eg008_grant_office_access_to_form_group/controller.py b/app/rooms/examples/eg008_grant_office_access_to_form_group/controller.py
index e30ea2f7..3e62111d 100644
--- a/app/rooms/examples/eg008_grant_office_access_to_form_group/controller.py
+++ b/app/rooms/examples/eg008_grant_office_access_to_form_group/controller.py
@@ -1,10 +1,6 @@
-from typing import List
-
from docusign_rooms import (
FormGroupsApi,
- FormGroupSummary,
FormGroupSummaryList,
- OfficeSummary,
OfficesApi,
OfficeSummaryList,
)
@@ -15,19 +11,17 @@
class Eg008Controller:
@staticmethod
- def get_args() -> dict:
+ def get_args():
"""Get required session and request arguments"""
return {
- "account_id": session["ds_account_id"],
- # Represents your {ACCOUNT_ID}
- "access_token": session["ds_access_token"],
- # Represents your {ACCESS_TOKEN}
+ "account_id": session["ds_account_id"], # Represents your {ACCOUNT_ID}
+ "access_token": session["ds_access_token"], # Represents your {ACCESS_TOKEN}
"form_group_id": request.form.get("form_group_id"),
"office_id": request.form.get("office_id")
}
@staticmethod
- def get_form_groups(args) -> List[FormGroupSummary]:
+ def get_form_groups(args):
"""
1. Create an API Client with headers
2. GET Form Groups via FormGroupsAPI
@@ -38,13 +32,13 @@ def get_form_groups(args) -> List[FormGroupSummary]:
# Step 2. GET Form Groups via FormGroupsAPI
form_groups_api = FormGroupsApi(api_client)
- responses = form_groups_api.get_form_groups(
+ response = form_groups_api.get_form_groups(
account_id=args["account_id"]) # type: FormGroupSummaryList
- return responses.form_groups
+ return response.form_groups
@staticmethod
- def get_offices(args) -> List[OfficeSummary]:
+ def get_offices(args):
"""
1. Create an API Client with headers
2. Get Offices via OfficesAPI
@@ -55,17 +49,16 @@ def get_offices(args) -> List[OfficeSummary]:
# Step 2. GET offices via OfficesAPI
offices_api = OfficesApi(api_client=api_client)
- responses = offices_api.get_offices(
+ response = offices_api.get_offices(
account_id=args["account_id"]) # type: OfficeSummaryList
- return responses.office_summaries
+ return response.office_summaries
@staticmethod
def worker(args):
"""
-
1. Create an API client with headers
- 2. Grant office access tp a form group via FormGroups API
+ 2. Grant office access to a form group via FormGroups API
"""
# Step 1. Create an API client with headers
diff --git a/app/rooms/examples/eg008_grant_office_access_to_form_group/views.py b/app/rooms/examples/eg008_grant_office_access_to_form_group/views.py
index 06e2cdf3..6a8043af 100644
--- a/app/rooms/examples/eg008_grant_office_access_to_form_group/views.py
+++ b/app/rooms/examples/eg008_grant_office_access_to_form_group/views.py
@@ -27,7 +27,6 @@ def assign_office_to_form_group():
return process_error(err)
# 3. Render the response
-
return render_template(
"example_done.html",
title="Assign office to a form group",
diff --git a/app/rooms/examples/eg009_assign_form_to_form_group/controller.py b/app/rooms/examples/eg009_assign_form_to_form_group/controller.py
index cdb7dc19..ca55ed68 100644
--- a/app/rooms/examples/eg009_assign_form_to_form_group/controller.py
+++ b/app/rooms/examples/eg009_assign_form_to_form_group/controller.py
@@ -1,12 +1,8 @@
-from typing import List
-
from docusign_rooms import (
- FormGroupSummary,
FormGroupsApi,
FormGroupSummaryList,
FormLibrariesApi,
FormGroupFormToAssign,
- FormSummary,
)
from docusign_rooms import FormSummaryList
from flask import session, request
@@ -16,36 +12,34 @@
class Eg009Controller:
@staticmethod
- def get_args() -> dict:
+ def get_args():
"""Get required session and request arguments"""
return {
- "account_id": session["ds_account_id"],
- # Represents your {ACCOUNT_ID}
- "access_token": session["ds_access_token"],
- # Represents your {ACCESS_TOKEN}
+ "account_id": session["ds_account_id"], # Represents your {ACCOUNT_ID}
+ "access_token": session["ds_access_token"], # Represents your {ACCESS_TOKEN}
"form_group_id": request.form.get("form_group_id"),
- 'form_id': request.form.get('form_id')
+ "form_id": request.form.get("form_id")
}
@staticmethod
- def get_form_groups(args) -> List[FormGroupSummary]:
+ def get_form_groups(args):
"""
1. Create an API Client with headers
2. GET Form Groups via FormGroupsAPI
"""
# Step 1. Create an API with headers with headers
- api_client = create_rooms_api_client(access_token=args['access_token'])
+ api_client = create_rooms_api_client(access_token=args["access_token"])
# Step 2. GET Form Groups via FormGroupsAPI
form_groups_api = FormGroupsApi(api_client)
- responses = form_groups_api.get_form_groups(
- account_id=args['account_id']) # type: FormGroupSummaryList
+ response = form_groups_api.get_form_groups(
+ account_id=args["account_id"]) # type: FormGroupSummaryList
- return responses.form_groups
+ return response.form_groups
@staticmethod
- def get_forms(args) -> List[FormSummary]:
+ def get_forms(args):
"""
1. Create an API client with headers
2. Get first form library id
@@ -71,7 +65,7 @@ def get_forms(args) -> List[FormSummary]:
return form_library_forms.forms
@staticmethod
- def worker(args) -> FormGroupFormToAssign:
+ def worker(args):
"""
1. Create an API Client with headers
2. Create FormGroupFormToAssign Object
@@ -79,16 +73,16 @@ def worker(args) -> FormGroupFormToAssign:
"""
# Step 1. Create an API client with headers
- api_client = create_rooms_api_client(access_token=args['access_token'])
+ api_client = create_rooms_api_client(access_token=args["access_token"])
form_groups_api = FormGroupsApi(api_client)
# Step 2. Create FormGroupFormToAssign Object
form_group_to_assign = FormGroupFormToAssign(form_id=args["form_id"],
is_required=True)
- # Step 3. Grant office access tp a form group via FormGroups API
+ # Step 3. Assign form to a form group via FormGroups API
response = form_groups_api.assign_form_group_form(
- form_group_id=args['form_group_id'], account_id=args['account_id'],
+ form_group_id=args["form_group_id"], account_id=args["account_id"],
body=form_group_to_assign
) # type: FormGroupFormToAssign
diff --git a/app/rooms/examples/eg009_assign_form_to_form_group/views.py b/app/rooms/examples/eg009_assign_form_to_form_group/views.py
index 19b2d494..8ccede66 100644
--- a/app/rooms/examples/eg009_assign_form_to_form_group/views.py
+++ b/app/rooms/examples/eg009_assign_form_to_form_group/views.py
@@ -11,7 +11,7 @@
eg009 = Blueprint(eg, __name__)
-@eg009.route("/eg009", methods=['POST'])
+@eg009.route("/eg009", methods=["POST"])
@authenticate(eg=eg)
def assign_form_to_form_group():
"""
@@ -44,7 +44,7 @@ def assign_form_to_form_group():
)
-@eg009.route("/eg009", methods=['GET'])
+@eg009.route("/eg009", methods=["GET"])
@authenticate(eg=eg)
def get_view():
"""
diff --git a/requirements.txt b/requirements.txt
index e3629f6a..f07381a5 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -30,5 +30,4 @@ virtualenv==16.7.5
virtualenv-clone==0.5.3
Werkzeug==0.16.0
wrapt==1.11.2
-pyjwt==1.7.1
From 2af909cf5cfc994acb838147f9bafaf7eaac8cec Mon Sep 17 00:00:00 2001
From: Vladyslav Turchynevych
Date: Mon, 4 Jan 2021 11:48:00 +0200
Subject: [PATCH 10/17] fix readme.md
---
README.md | 1 -
1 file changed, 1 deletion(-)
diff --git a/README.md b/README.md
index 2c6eb115..12787d8e 100644
--- a/README.md
+++ b/README.md
@@ -152,7 +152,6 @@ This example demonstrates how to return rooms that have had their field data,
updated within the time period between Start date and End date.
1. **Create an external form fillable session.**
[Source.](./app/rooms/examples/eg006_create_external_form_fill_session/controller.py)
-<<<<<<< HEAD
This example demonstrates how to create an
external form fill session
using the Rooms API:
From e9de45dce739eb99df6d845a07001545e2cc0320 Mon Sep 17 00:00:00 2001
From: Vladyslav Turchynevych
Date: Mon, 4 Jan 2021 11:51:32 +0200
Subject: [PATCH 11/17] fix typo
---
app/rooms/templates/home_rooms.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/rooms/templates/home_rooms.html b/app/rooms/templates/home_rooms.html
index 1c617a47..333cb1f1 100644
--- a/app/rooms/templates/home_rooms.html
+++ b/app/rooms/templates/home_rooms.html
@@ -81,7 +81,7 @@
From 48c0b44751bb480a1b04ca2ec944890f105ad753 Mon Sep 17 00:00:00 2001
From: Vladyslav Turchynevych
Date: Mon, 4 Jan 2021 12:31:33 +0200
Subject: [PATCH 13/17] additional permutations
---
.../examples/eg009_assign_form_to_form_group/controller.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/rooms/examples/eg009_assign_form_to_form_group/controller.py b/app/rooms/examples/eg009_assign_form_to_form_group/controller.py
index a5ea9c9d..603e3537 100644
--- a/app/rooms/examples/eg009_assign_form_to_form_group/controller.py
+++ b/app/rooms/examples/eg009_assign_form_to_form_group/controller.py
@@ -52,14 +52,14 @@ def get_forms(args):
# Step 2. Get first form library id
form_libraries_api = FormLibrariesApi(api_client)
form_libraries = form_libraries_api.get_form_libraries(
- account_id=args["account_id"])
+ account_id=args["account_id"]
+ )
first_form_library_id = form_libraries.forms_library_summaries[0].forms_library_id
# Step 3. Get forms
form_library_forms = form_libraries_api.get_form_library_forms(
- form_library_id=first_form_library_id,
- account_id=args["account_id"]
+ form_library_id=first_form_library_id, account_id=args["account_id"]
) # type: FormSummaryList
return form_library_forms.forms
From 1a524b6f2d90fb85da5e755b13edfc9feb70c020 Mon Sep 17 00:00:00 2001
From: Vladyslav Turchynevych
Date: Mon, 11 Jan 2021 11:01:48 +0200
Subject: [PATCH 14/17] add logger and end line
---
.../eg008_grant_office_access_to_form_group/views.py | 6 +++++-
.../examples/eg009_assign_form_to_form_group/controller.py | 3 ++-
app/rooms/templates/eg007_create_form_group.html | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/app/rooms/examples/eg008_grant_office_access_to_form_group/views.py b/app/rooms/examples/eg008_grant_office_access_to_form_group/views.py
index 6a8043af..ed3f496d 100644
--- a/app/rooms/examples/eg008_grant_office_access_to_form_group/views.py
+++ b/app/rooms/examples/eg008_grant_office_access_to_form_group/views.py
@@ -1,5 +1,5 @@
from docusign_rooms.client.api_exception import ApiException
-from flask import Blueprint, render_template
+from flask import Blueprint, render_template, current_app
from app.docusign import authenticate
from app.error_handlers import process_error
@@ -23,6 +23,10 @@ def assign_office_to_form_group():
try:
# 2. Call the worker method to assign office to form group
Eg008Controller.worker(args)
+ current_app.logger.info(
+ f"""Office {args['office_id']} has been assigned to Form Group
+ {args['form_group_id']}!"""
+ )
except ApiException as err:
return process_error(err)
diff --git a/app/rooms/examples/eg009_assign_form_to_form_group/controller.py b/app/rooms/examples/eg009_assign_form_to_form_group/controller.py
index 603e3537..d7ebd85f 100644
--- a/app/rooms/examples/eg009_assign_form_to_form_group/controller.py
+++ b/app/rooms/examples/eg009_assign_form_to_form_group/controller.py
@@ -34,7 +34,8 @@ def get_form_groups(args):
# Step 2. GET Form Groups via FormGroupsAPI
form_groups_api = FormGroupsApi(api_client)
response = form_groups_api.get_form_groups(
- account_id=args["account_id"]) # type: FormGroupSummaryList
+ account_id=args["account_id"]
+ ) # type: FormGroupSummaryList
return response.form_groups
diff --git a/app/rooms/templates/eg007_create_form_group.html b/app/rooms/templates/eg007_create_form_group.html
index 617732f3..bf717000 100644
--- a/app/rooms/templates/eg007_create_form_group.html
+++ b/app/rooms/templates/eg007_create_form_group.html
@@ -20,4 +20,4 @@
1. Creating a form group
-{% endblock %}
\ No newline at end of file
+{% endblock %}
From 4f1fcd354a67f01707c7198e05fab4849ecb07a2 Mon Sep 17 00:00:00 2001
From: Vladyslav Turchynevych
Date: Mon, 11 Jan 2021 11:11:00 +0200
Subject: [PATCH 15/17] added removed comment
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 93f6efa0..14494f7e 100644
--- a/README.md
+++ b/README.md
@@ -168,6 +168,7 @@ This example demonstrates how to grant Office access to a Form Group.
This example demonstrates how to assign a form to a form group.
## Click API
+