Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/FaxLineDelete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void Main()
var faxLineApi = new FaxLineApi(config);

var data = new FaxLineDeleteRequest(
number: "[FAX_NUMBER]",
number: "[FAX_NUMBER]"
);

try
Expand Down
2 changes: 1 addition & 1 deletion examples/TemplateUpdateFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static void Main()
};

var data = new TemplateUpdateFilesRequest(
files: files,
files: files
);

var templateId = "21f920ec2b7f4b6bb64d3ed79f26303843046536";
Expand Down
2 changes: 1 addition & 1 deletion sdks/dotnet/docs/FaxLineApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public class Example
var faxLineApi = new FaxLineApi(config);

var data = new FaxLineDeleteRequest(
number: "[FAX_NUMBER]",
number: "[FAX_NUMBER]"
);

try
Expand Down
2 changes: 1 addition & 1 deletion sdks/dotnet/docs/TemplateApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ public class Example
};

var data = new TemplateUpdateFilesRequest(
files: files,
files: files
);

var templateId = "21f920ec2b7f4b6bb64d3ed79f26303843046536";
Expand Down
3 changes: 2 additions & 1 deletion sdks/dotnet/run-build
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ docker run --rm \
-t "/local/templates" \
-o "/local/"

bash "${DIR}/bin/dotnet" dotnet format ./

printf "\nInstalling composer dependencies ...\n"
mkdir -p "${DIR}/vendor"
bash "${DIR}/bin/php" composer install
Expand Down Expand Up @@ -48,4 +50,3 @@ printf "Running tests ...\n"
bash "${DIR}/bin/dotnet" dotnet test src/Dropbox.Sign.Test/

printf "Success!\n"

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void SignatureRequestBulkSendWithTemplateTest()
TestHelper.AssertJsonSame(responseData.ToString(), response.ToJson());
}

[Fact(Skip="POST /signature_request/cancel/{signature_request_id} skipped")]
[Fact(Skip = "POST /signature_request/cancel/{signature_request_id} skipped")]
public void SignatureRequestCancelTest()
{
}
Expand Down Expand Up @@ -106,7 +106,7 @@ public void SignatureRequestCreateEmbeddedWithTemplateTest()
TestHelper.AssertJsonSame(responseData.ToString(), response.ToJson());
}

[Fact(Skip="GET /signature_request/files/{signature_request_id} skipped")]
[Fact(Skip = "GET /signature_request/files/{signature_request_id} skipped")]
public void SignatureRequestFilesTest()
{
}
Expand Down Expand Up @@ -168,7 +168,7 @@ public void SignatureRequestRemindTest()
TestHelper.AssertJsonSame(responseData.ToString(), response.ToJson());
}

[Fact(Skip="POST /signature_request/remove/{signature_request_id} skipped")]
[Fact(Skip = "POST /signature_request/remove/{signature_request_id} skipped")]
public void SignatureRequestRemoveTest()
{
}
Expand Down
2 changes: 1 addition & 1 deletion sdks/dotnet/src/Dropbox.Sign.Test/Api/TeamApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void TeamCreateTest()
TestHelper.AssertJsonSame(responseData.ToString(), response.ToJson());
}

[Fact(Skip="DELETE /team/destroy skipped")]
[Fact(Skip = "DELETE /team/destroy skipped")]
public void TeamDeleteTest()
{
}
Expand Down
4 changes: 2 additions & 2 deletions sdks/dotnet/src/Dropbox.Sign.Test/Api/TemplateApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public void TemplateCreateEmbeddedDraftTest()
TestHelper.AssertJsonSame(responseData.ToString(), response.ToJson());
}

[Fact(Skip="POST /template/delete/{template_id} skipped")]
[Fact(Skip = "POST /template/delete/{template_id} skipped")]
public void TemplateDeleteTest()
{
}

[Fact(Skip="GET /template/files/{signature_request_id} skipped")]
[Fact(Skip = "GET /template/files/{signature_request_id} skipped")]
public void TemplateFilesTest()
{
}
Expand Down
4 changes: 2 additions & 2 deletions sdks/dotnet/src/Dropbox.Sign.Test/EventCallbackHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void IsValidTest()
EventCallbackHelper.GetCallbackType(callbackEvent)
);
}

var app_keys = new List<string>
{
"base",
Expand All @@ -53,7 +53,7 @@ public void IsValidTest()
Assert.True(EventCallbackHelper.IsValid(ApiKey, callbackEvent));
Assert.False(EventCallbackHelper.IsValid(Reverse(ApiKey), callbackEvent));
Assert.Equal(
EventCallbackHelper.EVENT_TYPE_APP_CALLBACK,
EventCallbackHelper.EVENT_TYPE_APP_CALLBACK,
EventCallbackHelper.GetCallbackType(callbackEvent)
);
}
Expand Down
8 changes: 4 additions & 4 deletions sdks/dotnet/src/Dropbox.Sign.Test/MockRestClientHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static T CreateApiExpectContentContains<S, T>(S data,
.With(request =>
{
var stream = request.Content.ReadAsStream();
var streamReader = new StreamReader( stream );
var streamReader = new StreamReader(stream);
var content = streamReader.ReadToEnd();
return values.All(value => content.Contains(value));
})
Expand All @@ -85,13 +85,13 @@ private static T CreateApiInternal<T>(MockHttpMessageHandler handler)
var mockRestClient = new RestClient(options,
configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, GlobalConfiguration.Instance))
);

Configuration config = new Configuration();
config.Username = "YOUR_API_KEY";
var client = new ApiClient(config.BasePath, mockRestClient);
return (T)Activator.CreateInstance(typeof(T), client, client, config);
}

/// <summary>
/// Specifies the settings on a <see cref="JsonSerializer" /> object.
/// These settings can be adjusted to accommodate custom serialization rules.
Expand All @@ -109,7 +109,7 @@ private static T CreateApiInternal<T>(MockHttpMessageHandler handler)
}
};
}

// see ApiClient::CustomJsonCodec
internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static IEnumerable<object[]> Data()
var payload = JsonConvert.DeserializeObject<Dictionary<string, object>>(r.ReadToEnd());
Assert.NotNull(payload);

return new List<object[]> {new object[] {payload}};
return new List<object[]> { new object[] { payload } };
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions sdks/dotnet/src/Dropbox.Sign/Client/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,15 @@ public ApiClient(string basePath)
}

/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />. This should be used in unit tests only
/// </summary>
/// Initializes a new instance of the <see cref="ApiClient" />. This should be used in unit tests only
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <param name="mockClient">Mock client for unit testing purpose </param>
/// <exception cref="ArgumentException"></exception>
public ApiClient(string basePath, RestClient mockClient)
{
if (string.IsNullOrEmpty(basePath))
throw new ArgumentException("basePath cannot be empty");
throw new ArgumentException("basePath cannot be empty");

_baseUrl = basePath;
_restClient = mockClient;
Expand Down Expand Up @@ -479,7 +479,7 @@ private async Task<ApiResponse<T>> ExecClientAsync<T>(Func<RestClient, Task<Rest
RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
setOptions(clientOptions);

RestClient client = _restClient;
if (client == null)
{
Expand Down Expand Up @@ -559,7 +559,7 @@ private async Task<ApiResponse<T>> ExecClientAsync<T>(Func<RestClient, Task<Rest

private RestResponse<T> DeserializeRestResponseFromPolicy<T>(RestClient client, RestRequest request, PolicyResult<RestResponse> policyResult)
{
if (policyResult.Outcome == OutcomeType.Successful)
if (policyResult.Outcome == OutcomeType.Successful)
{
return client.Deserialize<T>(policyResult.Result);
}
Expand All @@ -571,7 +571,7 @@ private RestResponse<T> DeserializeRestResponseFromPolicy<T>(RestClient client,
};
}
}

private ApiResponse<T> Exec<T>(RestRequest request, RequestOptions options, IReadableConfiguration configuration)
{
Action<RestClientOptions> setOptions = (clientOptions) =>
Expand Down
11 changes: 7 additions & 4 deletions sdks/dotnet/src/Dropbox.Sign/Client/ClientUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ public static Multimap<string, string> ParameterToMultiMap(string collectionForm
}
else if (value is IDictionary dictionary)
{
if(collectionFormat == "deepObject") {
if (collectionFormat == "deepObject")
{
foreach (DictionaryEntry entry in dictionary)
{
parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value));
}
}
else {
else
{
foreach (DictionaryEntry entry in dictionary)
{
parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value));
Expand Down Expand Up @@ -105,7 +107,8 @@ public static string ParameterToString(object obj, IReadableConfiguration config
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
if (obj is bool boolean)
return boolean ? "true" : "false";
if (obj is ICollection collection) {
if (obj is ICollection collection)
{
List<string> entries = new List<string>();
foreach (var entry in collection)
entries.Add(ParameterToString(entry, configuration));
Expand Down Expand Up @@ -225,7 +228,7 @@ private static bool HasEnumMemberAttrValue(object enumVal)
var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException());
var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType<EnumMemberAttribute>().FirstOrDefault();
if (attr != null) return true;
return false;
return false;
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions sdks/dotnet/src/Dropbox.Sign/Client/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public Configuration(
/// <summary>
/// Gets or sets the base path for API access.
/// </summary>
public virtual string BasePath
public virtual string BasePath
{
get { return _basePath; }
set { _basePath = value; }
Expand Down Expand Up @@ -548,7 +548,7 @@ private string GetServerUrl(IList<IReadOnlyDictionary<string, object>> servers,

return url;
}

/// <summary>
/// Gets and Sets the RemoteCertificateValidationCallback
/// </summary>
Expand All @@ -565,7 +565,7 @@ public static string ToDebugReport()
{
string report = "C# SDK (Dropbox.Sign) Debug Report:\n";
report += " OS: " + System.Environment.OSVersion + "\n";
report += " .NET Framework Version: " + System.Environment.Version + "\n";
report += " .NET Framework Version: " + System.Environment.Version + "\n";
report += " Version of the API: 3.0.0\n";
report += " SDK Package Version: 1.6-dev\n";

Expand Down
2 changes: 1 addition & 1 deletion sdks/dotnet/src/Dropbox.Sign/EventCallbackHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class EventCallbackHelper

public const string EVENT_TYPE_APP_CALLBACK = "app_callback";

private EventCallbackHelper() {}
private EventCallbackHelper() { }

/// <summary>
/// Verify that a callback came from HelloSign.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Dropbox.Sign.Model
public struct OpenApiType
{
public string Name { set; get; }
public string Property { set; get; }
public string Property { set; get; }
public string Type { set; get; }
public object Value { set; get; }
}
Expand Down
30 changes: 17 additions & 13 deletions sdks/dotnet/src/Dropbox.Sign/Model/AccountCreateRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected AccountCreateRequest() { }
/// <param name="locale">The locale used in this Account. Check out the list of [supported locales](/api/reference/constants/#supported-locales) to learn more about the possible values..</param>
public AccountCreateRequest(string clientId = default(string), string clientSecret = default(string), string emailAddress = default(string), string locale = default(string))
{

// to ensure "emailAddress" is required (not null)
if (emailAddress == null)
{
Expand Down Expand Up @@ -81,28 +81,28 @@ public static AccountCreateRequest Init(string jsonData)
/// <value>The email address which will be associated with the new Account.</value>
[DataMember(Name = "email_address", IsRequired = true, EmitDefaultValue = true)]
public string EmailAddress { get; set; }

/// <summary>
/// Used when creating a new account with OAuth authorization. See [OAuth 2.0 Authorization](https://app.hellosign.com/api/oauthWalkthrough#OAuthAuthorization)
/// </summary>
/// <value>Used when creating a new account with OAuth authorization. See [OAuth 2.0 Authorization](https://app.hellosign.com/api/oauthWalkthrough#OAuthAuthorization)</value>
[DataMember(Name = "client_id", EmitDefaultValue = true)]
public string ClientId { get; set; }

/// <summary>
/// Used when creating a new account with OAuth authorization. See [OAuth 2.0 Authorization](https://app.hellosign.com/api/oauthWalkthrough#OAuthAuthorization)
/// </summary>
/// <value>Used when creating a new account with OAuth authorization. See [OAuth 2.0 Authorization](https://app.hellosign.com/api/oauthWalkthrough#OAuthAuthorization)</value>
[DataMember(Name = "client_secret", EmitDefaultValue = true)]
public string ClientSecret { get; set; }

/// <summary>
/// The locale used in this Account. Check out the list of [supported locales](/api/reference/constants/#supported-locales) to learn more about the possible values.
/// </summary>
/// <value>The locale used in this Account. Check out the list of [supported locales](/api/reference/constants/#supported-locales) to learn more about the possible values.</value>
[DataMember(Name = "locale", EmitDefaultValue = true)]
public string Locale { get; set; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
Expand Down Expand Up @@ -149,22 +149,22 @@ public bool Equals(AccountCreateRequest input)
{
return false;
}
return
return
(
this.EmailAddress == input.EmailAddress ||
(this.EmailAddress != null &&
this.EmailAddress.Equals(input.EmailAddress))
) &&
) &&
(
this.ClientId == input.ClientId ||
(this.ClientId != null &&
this.ClientId.Equals(input.ClientId))
) &&
) &&
(
this.ClientSecret == input.ClientSecret ||
(this.ClientSecret != null &&
this.ClientSecret.Equals(input.ClientSecret))
) &&
) &&
(
this.Locale == input.Locale ||
(this.Locale != null &&
Expand Down Expand Up @@ -213,25 +213,29 @@ IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext vali
public List<OpenApiType> GetOpenApiTypes()
{
var types = new List<OpenApiType>();
types.Add(new OpenApiType(){
types.Add(new OpenApiType()
{
Name = "email_address",
Property = "EmailAddress",
Type = "string",
Value = EmailAddress,
});
types.Add(new OpenApiType(){
types.Add(new OpenApiType()
{
Name = "client_id",
Property = "ClientId",
Type = "string",
Value = ClientId,
});
types.Add(new OpenApiType(){
types.Add(new OpenApiType()
{
Name = "client_secret",
Property = "ClientSecret",
Type = "string",
Value = ClientSecret,
});
types.Add(new OpenApiType(){
types.Add(new OpenApiType()
{
Name = "locale",
Property = "Locale",
Type = "string",
Expand Down
Loading