Skip to content

Commit

Permalink
Version 2.0.0-rc1-v2.0-2.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Apr 10, 2024
1 parent 47e318e commit 0473974
Show file tree
Hide file tree
Showing 23 changed files with 246 additions and 126 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## [v2.0.0-rc1] - Monitor API v2.0-2.0.0 - 2024-04-05
### Breaking Changes
- Updated C# SDK dependencies.
- Microsoft.CSharp: Version bumped from 4.5.0 to 4.7.0.
- Newtonsoft.Json: Version bumped from 13.0.1 to 13.0.3.
- System.ComponentModel.Annotations: Version bumped from 4.5.0 to 5.0.0.
- Microsoft.IdentityModel.Protocols: Version bumped from 5.4.0 to 7.3.1.
- System.IdentityModel.Tokens.Jwt: Version bumped from 5.4.0 to 7.3.1.
- BouncyCastle.Cryptography: Version bumped from 2.2.1 to 2.3.0.
### Changed
- Updated the SDK release version.

## [v1.2.1] - Monitor API v2.0-2.0.0 - 2023-12-15
### Changed
- Updated the SDK release version.
- Removed tracked files which are now present in .gitignore.

## [v1.2.0] - Monitor API v2.0-2.0.0 - 2023-06-14
### Changed
- Added support for version v2.0-2.0.0 of the DocuSign Monitor API.
Expand Down
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License
The MIT License

Copyright (c) 2020 DocuSign Inc.
Copyright (c) 2020 - DocuSign, Inc. (https://www.docusign.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
2 changes: 1 addition & 1 deletion sdk/.swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.21-SNAPSHOT
2.4.21
21 changes: 9 additions & 12 deletions sdk/DocuSign.Monitor.sln
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29509.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocuSign.Rooms", "src\DocuSign.Monitor\DocuSign.Monitor.csproj", "{6E3B93F3-8407-4C94-A73D-42A2D0ED2E35}"
# Visual Studio 2012
VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DocuSign.Monitor", "src\DocuSign.Monitor\DocuSign.Monitor.csproj", "{7C3EC099-EE1B-42B7-B644-12B6E8FA3E3B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6E3B93F3-8407-4C94-A73D-42A2D0ED2E35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6E3B93F3-8407-4C94-A73D-42A2D0ED2E35}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6E3B93F3-8407-4C94-A73D-42A2D0ED2E35}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6E3B93F3-8407-4C94-A73D-42A2D0ED2E35}.Release|Any CPU.Build.0 = Release|Any CPU
{7C3EC099-EE1B-42B7-B644-12B6E8FA3E3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C3EC099-EE1B-42B7-B644-12B6E8FA3E3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C3EC099-EE1B-42B7-B644-12B6E8FA3E3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C3EC099-EE1B-42B7-B644-12B6E8FA3E3B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CA303803-4024-4EE9-8A5C-EAFB2427F8CF}
EndGlobalSection
EndGlobal
EndGlobal
16 changes: 14 additions & 2 deletions sdk/src/DocuSign.Monitor/Api/DataSetApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,16 @@ public ApiResponse<CursoredResult> GetStreamWithHttpInfo(string version, string
if (options.limit != null) localVarQueryParams.Add("limit", this.ApiClient.ParameterToString(options.limit)); // query parameter
}

// authentication (docusignAccessCode) required
// oauth required
if (!String.IsNullOrEmpty(this.ApiClient.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.ApiClient.Configuration.AccessToken;
}


// make the HTTP request
DocuSignRequest localVarRequest = this.ApiClient.PrepareRequest(localVarPath, HttpMethod.Get, localVarQueryParams.ToList(), localVarPostBody, localVarHeaderParams.ToList(), localVarFormParams.ToList(), localVarPathParams.ToList(), localVarFileParams, localVarHttpContentType, localVarHttpContentDisposition);
DocuSignRequest localVarRequest = this.ApiClient.PrepareRequest(localVarPath, new HttpMethod("GET"), localVarQueryParams.ToList(), localVarPostBody, localVarHeaderParams.ToList(), localVarFormParams.ToList(), localVarPathParams.ToList(), localVarFileParams, localVarHttpContentType, localVarHttpContentDisposition);
DocuSignResponse localVarResponse = this.ApiClient.CallApi(localVarRequest);

int localVarStatusCode = (int)localVarResponse.StatusCode;
Expand Down Expand Up @@ -289,10 +295,16 @@ public async System.Threading.Tasks.Task<ApiResponse<CursoredResult>> GetStreamA
if (options.limit != null) localVarQueryParams.Add("limit", this.ApiClient.ParameterToString(options.limit)); // query parameter
}

// authentication (docusignAccessCode) required
// oauth required
if (!String.IsNullOrEmpty(this.ApiClient.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.ApiClient.Configuration.AccessToken;
}


// make the HTTP request
DocuSignRequest localVarRequest = this.ApiClient.PrepareRequest(localVarPath, HttpMethod.Get, localVarQueryParams.ToList(), localVarPostBody, localVarHeaderParams.ToList(), localVarFormParams.ToList(), localVarPathParams.ToList(), localVarFileParams, localVarHttpContentType, localVarHttpContentDisposition);
DocuSignRequest localVarRequest = this.ApiClient.PrepareRequest(localVarPath, new HttpMethod("GET"), localVarQueryParams.ToList(), localVarPostBody, localVarHeaderParams.ToList(), localVarFormParams.ToList(), localVarPathParams.ToList(), localVarFileParams, localVarHttpContentType, localVarHttpContentDisposition);
DocuSignResponse localVarResponse = await this.ApiClient.CallApiAsync(localVarRequest);

int localVarStatusCode = (int)localVarResponse.StatusCode;
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/DocuSign.Monitor/Client/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ public class ApiClient : DocuSignClient
{
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" /> class
/// with default configuration and base path (https://lens.docusign.net).
/// with default configuration and base path (https://lens-d.docusign.net).
/// </summary>
[Obsolete("ApiClient is now obsolete and will be removed in a future release. Use DocuSignClient() instead.", false)]
public ApiClient() : base() { }

/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" /> class
/// with default base path (https://lens.docusign.net).
/// with default base path (https://lens-d.docusign.net).
/// </summary>
/// <param name="configuration">An instance of Configuration.</param>
[Obsolete("ApiClient is now obsolete and will be removed in a future release. Use DocuSignClient(Configuration) instead.", false)]
Expand Down
8 changes: 4 additions & 4 deletions sdk/src/DocuSign.Monitor/Client/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Configuration
/// Version of the package.
/// </summary>
/// <value>Version of the package.</value>
public const string Version = "1.2.0";
public const string Version = "2.0.0-rc1";

/// <summary>
/// Identifier for ISO 8601 DateTime Format
Expand Down Expand Up @@ -102,10 +102,10 @@ static Configuration()
/// <summary>
/// Initializes a new instance of the <see cref="Configuration" /> class
/// </summary>
public Configuration(string basePath = "https://lens.docusign.net")
public Configuration(string basePath = "https://lens-d.docusign.net")
{
UserAgent = $"C#/{Version}/{_getFrameworkVersion()}";
BasePath = basePath ?? "https://lens.docusign.net";
UserAgent = $"Swagger-Codegen/v2.0/{Version}/C#/{_getFrameworkVersion()}";
BasePath = basePath ?? "https://lens-d.docusign.net";
DefaultHeader = new ConcurrentDictionary<string, string>();
ApiKey = new ConcurrentDictionary<string, string>();
ApiKeyPrefix = new ConcurrentDictionary<string, string>();
Expand Down
34 changes: 17 additions & 17 deletions sdk/src/DocuSign.Monitor/Client/DocuSignClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ public class DocuSignClient
// Stage base path
public const string Stage_REST_BasePath = "https://lens-s.docusign.net";

protected string basePath = Production_REST_BasePath;
protected string basePath = Demo_REST_BasePath;

protected Uri baseUri => Uri.TryCreate(basePath, UriKind.Absolute, out Uri uri) ? uri : new Uri(Production_REST_BasePath);
protected Uri baseUri => Uri.TryCreate(basePath, UriKind.Absolute, out Uri uri) ? uri : new Uri(Demo_REST_BasePath);

protected string oAuthBasePath = OAuth.Production_OAuth_BasePath;
protected string oAuthBasePath = OAuth.Demo_OAuth_BasePath;

protected string oAuthBasePathWithScheme => $"https://{oAuthBasePath}/";

protected Uri oAuthBaseUri => Uri.TryCreate(oAuthBasePathWithScheme, UriKind.Absolute, out Uri uri) ? uri : new Uri(OAuth.Production_OAuth_BasePath);
protected Uri oAuthBaseUri => Uri.TryCreate(oAuthBasePathWithScheme, UriKind.Absolute, out Uri uri) ? uri : new Uri(OAuth.Demo_OAuth_BasePath);

protected JsonSerializerSettings serializerSettings = new JsonSerializerSettings
{
Expand Down Expand Up @@ -82,13 +82,13 @@ public virtual void InterceptResponse(DocuSignRequest request, DocuSignResponse

/// <summary>
/// Initializes a new instance of <see cref="DocuSignClient"/> with default
/// with default base path (https://lens.docusign.net).
/// with default base path (https://lens-d.docusign.net).
/// </summary>
public DocuSignClient()
{
Configuration = new Configuration();

SetBasePath(Production_REST_BasePath);
SetBasePath(Demo_REST_BasePath);
RestClient = buildDefaultHttpClient();

SetOAuthBasePath();
Expand All @@ -98,14 +98,14 @@ public DocuSignClient()

/// <summary>
/// Initializes a new instance of <see cref="DocuSignClient"/> using
/// the provided configuration with the default base path (https://lens.docusign.net).
/// the provided configuration with the default base path (https://lens-d.docusign.net).
/// </summary>
/// <param name="configuration">Provided pre-populated <see cref="Configuration"/> object</param>
public DocuSignClient(Configuration configuration)
{
Configuration = configuration ?? new Configuration();

SetBasePath(string.IsNullOrEmpty(configuration.BasePath) ? Production_REST_BasePath : configuration.BasePath);
SetBasePath(string.IsNullOrEmpty(configuration.BasePath) ? Demo_REST_BasePath : configuration.BasePath);
RestClient = buildDefaultHttpClient(configuration?.Timeout ?? Configuration.DefaultTimeoutValue);

SetOAuthBasePath();
Expand Down Expand Up @@ -181,7 +181,7 @@ public DocuSignClient(string apiBase, HttpClient apiClient)
/// <param name="client"></param>
public DocuSignClient(string apiBase, IHttpClient client)
{
string baseUrl = string.IsNullOrEmpty(apiBase) ? Production_REST_BasePath : apiBase;
string baseUrl = string.IsNullOrEmpty(apiBase) ? Demo_REST_BasePath : apiBase;
Configuration = new Configuration(baseUrl);

SetBasePath(baseUrl);
Expand Down Expand Up @@ -235,24 +235,24 @@ public DocuSignRequest PrepareOAuthRequest(string oAuthBasePath, string path, Ht
public DocuSignRequest PrepareRequest(string path, HttpMethod method, List<KeyValuePair<string, string>> queryParams = null, object postBody = null, List<KeyValuePair<string, string>> headerParams = null,
List<KeyValuePair<string, string>> formParams = null, List<KeyValuePair<string, string>> pathParams = null, List<FileParameter> fileParams = null, string contentType = null, string contentDisposition = null)
{
string url = $"{basePath}{path}";
string url = $"{basePath}{path}";
return new DocuSignRequest(method, url, queryParams, postBody, headerParams, formParams, pathParams, fileParams, contentType, contentDisposition);
}

public DocuSignResponse CallApi(DocuSignRequest request)
{
//InterceptRequest(request);
InterceptRequest(request);
var response = RestClient.SendRequest(request);
//InterceptResponse(request, response);
InterceptResponse(request, response);
return response;
}

public async Task<DocuSignResponse> CallApiAsync(DocuSignRequest request)
{
//InterceptRequest(request);
InterceptRequest(request);
CancellationTokenSource cts = new CancellationTokenSource();
var response = await RestClient.SendRequestAsync(request, cts.Token);
//InterceptResponse(request, response);
InterceptResponse(request, response);

return response;
}
Expand Down Expand Up @@ -720,11 +720,11 @@ public void SetOAuthBasePath(string oauthBaseUri = null)
//Derive OAuth Base Path if not given.
if (Uri.TryCreate(this.basePath, UriKind.Absolute, out Uri baseUri))
{
if (Uri.TryCreate(Demo_REST_BasePath, UriKind.Absolute, out Uri demoBaseUri) && (Uri.Compare(baseUri, demoBaseUri, UriComponents.Host, UriFormat.Unescaped, StringComparison.InvariantCultureIgnoreCase) == 0))
if (baseUri.Host.StartsWith("apps-d") || baseUri.Host.StartsWith("demo"))
{
this.oAuthBasePath = OAuth.Demo_OAuth_BasePath;
}
else if (Uri.TryCreate(Stage_REST_BasePath, UriKind.Absolute, out Uri stageBaseUri) && (Uri.Compare(baseUri, stageBaseUri, UriComponents.Host, UriFormat.Unescaped, StringComparison.InvariantCultureIgnoreCase) == 0))
else if (baseUri.Host.StartsWith("apps-s") || baseUri.Host.StartsWith("stage"))
{
this.oAuthBasePath = OAuth.Stage_OAuth_BasePath;
}
Expand All @@ -735,7 +735,7 @@ public void SetOAuthBasePath(string oauthBaseUri = null)
}
else
{
this.oAuthBasePath = OAuth.Production_OAuth_BasePath;
this.oAuthBasePath = OAuth.Demo_OAuth_BasePath;
}
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/src/DocuSign.Monitor/Client/DocuSignRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public DocuSignRequest(HttpMethod method, string path) : this(method, path, null
public DocuSignRequest(HttpMethod method, string path, string contentType) : this(method, path, null, null, null, null, null, null, contentType, null) { }

public DocuSignRequest(HttpMethod method, string path, List<KeyValuePair<string, string>> queryParams = null, Object bodyContent = null,
List<KeyValuePair<string, string>> headerParams = null, List<KeyValuePair<string, string>> postParams = null, List<KeyValuePair<string,string>> pathParams = null,
List<KeyValuePair<string, string>> headerParams = null, List<KeyValuePair<string, string>> postParams = null, List<KeyValuePair<string, string>> pathParams = null,
List<FileParameter> fileParams = null, string contentType = null, string contentDisposition = null)
{
Method = method;
Expand Down
28 changes: 27 additions & 1 deletion sdk/src/DocuSign.Monitor/Client/SystemNetHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,32 @@ private async Task<HttpResponseMessage> SendHttpRequestAsync(
return response;
}

bool isPostOrPutHttpMethod(HttpMethod method) => method == HttpMethod.Post || method == HttpMethod.Put;

bool isEmptyOrJsonContentType(string contentType, List<KeyValuePair<string, string>> headerParams)
{
if (contentType == "application/json")
{
return true;
}
else
{
KeyValuePair<string, string> contentTypeHeader = headerParams.FirstOrDefault(kvp => kvp.Key.ToLower() == "content-type");
if (contentTypeHeader.Value == "application/json" || string.IsNullOrEmpty(contentTypeHeader.Value))
{
return true;
}
}
return false;
}

private HttpRequestMessage BuildRequestMessage(DocuSignRequest request)
{
string contentType = string.IsNullOrEmpty(request.ContentType) ? "application/json" : request.ContentType;
var requestMessage = new HttpRequestMessage(request.Method, request.Url);

if (request.BodyContent != null)
{
string contentType = string.IsNullOrEmpty(request.ContentType) ? "application/json" : request.ContentType;
if (request.BodyContent is byte[])
{
requestMessage.Content = new ByteArrayContent(request.BodyContent as byte[]);
Expand Down Expand Up @@ -158,6 +177,13 @@ private HttpRequestMessage BuildRequestMessage(DocuSignRequest request)
}
requestMessage.Content = multipartFormContent;
}
else
{
if (isPostOrPutHttpMethod(request.Method) && isEmptyOrJsonContentType(request.ContentType, request.HeaderParams))
{
requestMessage.Content = new StringContent("{ }", System.Text.Encoding.UTF8, "application/json");
}
}
}

string uri = request.Url.ToString();
Expand Down
Loading

0 comments on commit 0473974

Please sign in to comment.