Skip to content

Commit

Permalink
Version 5.0.0rc2-v2.1-24.2.00.00 release (#193)
Browse files Browse the repository at this point in the history
Co-authored-by: root <root@devcenteradmin.docusigntest.com>
  • Loading branch information
garg-mudit and root authored Sep 6, 2024
1 parent 010d8d5 commit 1df2307
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 54 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.

See [DocuSign Support Center](https://support.docusign.com/en/releasenotes/) for Product Release Notes.

## [v5.0.0rc2] - eSignature API v2.1-24.2.00.00 - 2024-08-22
### Breaking Changes
- Updated datatype for `get_document` method from `envelopes_api`.
### Changed
- Updated the SDK release version.

## [v5.0.0rc1] - eSignature API v2.1-24.2.00.00 - 2024-06-28
### Changed
- Added support for version v2.1-24.2.00.00 of the DocuSign ESignature API.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This client SDK is provided as open source, which enables you to customize its f
<a id="versionInformation"></a>
### Version Information
- **API version**: v2.1
- **Latest SDK version**: 5.0.0rc1
- **Latest SDK version**: 5.0.0rc2

<a id="requirements"></a>
## Requirements
Expand Down
57 changes: 15 additions & 42 deletions docusign_esign/client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import re
import json
import mimetypes
import tempfile
import threading
import base64
import math
Expand Down Expand Up @@ -188,7 +187,11 @@ def __call_api(self, resource_path, method,
r.data = r.data.decode('utf8', 'replace')
except (UnicodeDecodeError, AttributeError):
pass
return_data = self.deserialize(r, response_type)

if response_type == "file":
return_data = r.data
else:
return_data = self.deserialize(r, response_type)
else:
return_data = None

Expand Down Expand Up @@ -255,10 +258,9 @@ def deserialize(self, response, response_type):
:return: deserialized object.
"""
# handle file downloading
# save response body into a tmp file and return the instance
# handle file type response
if response_type == "file":
return self.__deserialize_file(response)
return response.data

# fetch data from response object
try:
Expand Down Expand Up @@ -551,35 +553,6 @@ def update_params_for_auth(self, headers, querys, auth_settings):
'Authentication token must be in `query` or `header`'
)

def __deserialize_file(self, response):
"""
Saves response body into a file in a temporary folder,
using the filename from the `Content-Disposition` header if provided.
:param response: RESTResponse.
:return: file path.
"""
config = Configuration()

fd, path = tempfile.mkstemp(dir=config.temp_folder_path)
os.close(fd)
os.remove(path)

content_disposition = response.getheader("Content-Disposition")
if content_disposition:
filename = re.\
search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition).\
group(1)
curr_time = datetime.now()
formatted_time = curr_time.strftime('%m%d%Y_%H%M%S_%f')
filename = "{}_{}".format(formatted_time, filename)
path = os.path.join(os.path.dirname(path), filename)

with open(path, "wb") as f:
f.write(response.data)

return path

def __deserialize_primitive(self, data, klass):
"""
Deserializes string to primitive type.
Expand Down Expand Up @@ -671,9 +644,9 @@ def request_jwt_user_token(self, client_id, user_id, oauth_host_name, private_ke
scopes=(OAuth.SCOPE_SIGNATURE,)):
"""
Request JWT User Token
:param client_id: DocuSign OAuth Client Id(AKA Integrator Key)
:param user_id: DocuSign user Id to be impersonated
:param oauth_host_name: DocuSign OAuth host name
:param client_id: Docusign OAuth Client Id(AKA Integrator Key)
:param user_id: Docusign user Id to be impersonated
:param oauth_host_name: Docusign OAuth host name
:param private_key_bytes: the byte contents of the RSA private key
:param expires_in: number of seconds remaining before the JWT assertion is considered as invalid
:param scopes: Optional. The list of requested scopes may include (but not limited to) You can also pass any
Expand Down Expand Up @@ -714,8 +687,8 @@ def request_jwt_application_token(self, client_id, oauth_host_name, private_key_
scopes=(OAuth.SCOPE_SIGNATURE,)):
"""
Request JWT Application Token
:param client_id: DocuSign OAuth Client Id(AKA Integrator Key)
:param oauth_host_name: DocuSign OAuth host name
:param client_id: Docusign OAuth Client Id(AKA Integrator Key)
:param oauth_host_name: Docusign OAuth host name
:param private_key_bytes: the byte contents of the RSA private key
:param expires_in: number of seconds remaining before the JWT assertion is considered as invalid
:param scopes: Optional. The list of requested scopes may include (but not limited to) You can also pass any
Expand Down Expand Up @@ -772,8 +745,8 @@ def get_user_info(self, access_token):
def generate_access_token(self, client_id, client_secret, code):
"""
GenerateAccessToken will exchange the authorization code for an access token and refresh tokens.
:param client_id: DocuSign OAuth Client Id(AKA Integrator Key)
:param client_secret: The secret key you generated when you set up the integration in DocuSign Admin console.
:param client_id: Docusign OAuth Client Id(AKA Integrator Key)
:param client_secret: The secret key you generated when you set up the integration in Docusign Admin console.
:param code: The authorization code
:return: OAuthToken object
"""
Expand Down Expand Up @@ -828,7 +801,7 @@ def set_access_token(self, token_obj):
def get_authorization_uri(self, client_id, scopes, redirect_uri, response_type, state=None):
"""
Helper method to configure the OAuth accessCode/implicit flow parameters
:param client_id: DocuSign OAuth Client Id(AKA Integrator Key)
:param client_id: Docusign OAuth Client Id(AKA Integrator Key)
:param scopes: The list of requested scopes. Client applications may be scoped to a limited set of system access.
:param redirect_uri: This determines where to deliver the response containing the authorization code
:param response_type: Determines the response type of the authorization request, NOTE: these response types are
Expand Down
9 changes: 3 additions & 6 deletions docusign_esign/client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ def __init__(self):
# Default api client
self.api_client = None

# Temp file folder for downloading files
self.temp_folder_path = None

# Authentication Settings
# dict to store API key(s)
self.api_key = {}
Expand Down Expand Up @@ -119,9 +116,9 @@ def __init__(self):
python_version = platform.python_version()

if six.PY3:
self.user_agent = "Swagger-Codegen/v2.1/5.0.0rc1/python3/" + f"{python_version}"
self.user_agent = "Swagger-Codegen/v2.1/5.0.0rc2/python3/" + f"{python_version}"
else:
self.user_agent = "Swagger-Codegen/v2.1/5.0.0rc1/python2/" + f"{python_version}"
self.user_agent = "Swagger-Codegen/v2.1/5.0.0rc2/python2/" + f"{python_version}"


@classmethod
Expand Down Expand Up @@ -277,5 +274,5 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: v2.1\n"\
"SDK Package Version: 5.0.0rc1".\
"SDK Package Version: 5.0.0rc2".\
format(env=sys.platform, pyversion=sys.version)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from setuptools import setup, find_packages, Command, os # noqa: H301

NAME = "docusign-esign"
VERSION = "5.0.0rc1"
VERSION = "5.0.0rc2"
# To install the library, run the following
#
# python setup.py install
Expand Down
19 changes: 15 additions & 4 deletions test/unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import subprocess
import unittest
import tempfile

from time import sleep
from datetime import datetime
Expand Down Expand Up @@ -492,8 +493,10 @@ def testDownLoadEnvelopeDocuments(self):

file1 = envelopes_api.get_document(self.user_info.accounts[0].account_id, 'combined', self.envelope_id)

assert len(file1) > 0
subprocess.call('open ' + file1, shell=True)
temporary_file = tempfile.NamedTemporaryFile(delete=False)
with open(temporary_file.name + ".pdf", "wb") as f:
f.write(file1)
subprocess.call('open ' + temporary_file.name + ".pdf", shell=True)

except ApiException as e:
print("\nException when calling DocuSign API: %s" % e)
Expand Down Expand Up @@ -682,14 +685,22 @@ def testGetDiagnosticLogs(self):
envelope_id = envelope_summary.envelope_id

file1 = envelopes_api.get_document(self.user_info.accounts[0].account_id, 'combined', envelope_id)
temporary_file1 = tempfile.NamedTemporaryFile(delete=False)
with open(temporary_file1.name + ".pdf", "wb") as f:
f.write(file1)

assert len(file1) > 0
subprocess.call('open ' + file1, shell=True)
subprocess.call('open ' + temporary_file1.name + ".pdf", shell=True)

logs_list = diag_api.list_request_logs()
request_log_id = logs_list.api_request_logs[0].request_log_id
file2 = diag_api.get_request_log(request_log_id)
temporary_file2 = tempfile.NamedTemporaryFile(delete=False)
with open(temporary_file2.name + ".txt", "wb") as f:
f.write(file2)

assert len(file2) > 0
subprocess.call('open ' + file2, shell=True)
subprocess.call('open ' + temporary_file2.name + ".txt", shell=True)

except ApiException as e:
print("\nException when calling DocuSign API: %s" % e)
Expand Down

0 comments on commit 1df2307

Please sign in to comment.