Skip to content

Commit

Permalink
Merge pull request #96 from plivo/version_upgrade
Browse files Browse the repository at this point in the history
Version upgrade
  • Loading branch information
Sachin Kulshrestha authored Jan 4, 2019
2 parents f5d7117 + 536979d commit 1501cc7
Show file tree
Hide file tree
Showing 18 changed files with 94 additions and 90 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

# Change Log

## [v4.2.3](https://github.com/plivo/plivo-dotnet/tree/v4.2.3) (2019-01-04)
- Update Thread Safety handling for synchronous execution.

## [v4.2.2](https://github.com/plivo/plivo-dotnet/tree/v4.2.2) (2018-12-27)
- Fix dynamic object usage with async/await statement.

Expand Down
4 changes: 2 additions & 2 deletions src/Plivo/Client/SystemHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ public async Task<PlivoResponse<T>> SendRequest<T>(string method, string uri, Di
method + " not supported");
}

response = await _client.SendAsync(request);
response = await _client.SendAsync(request).ConfigureAwait(false);

var responseContent = await response.Content.ReadAsStringAsync();
var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

// create Plivo response object along with the deserialized object
PlivoResponse<T> plivoResponse;
Expand Down
2 changes: 1 addition & 1 deletion src/Plivo/Plivo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard1.3</TargetFrameworks>
<ReleaseVersion>4.2.2</ReleaseVersion>
<ReleaseVersion>4.2.3</ReleaseVersion>
<Version></Version>
<Authors>Plivo SDKs Team</Authors>
<Owners>Plivo Inc.</Owners>
Expand Down
3 changes: 2 additions & 1 deletion src/Plivo/Plivo.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
<summary>A .NET SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML</summary>
<description>A .NET SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML</description>
<id>Plivo</id>
<version>4.2.2</version>
<version>4.2.3</version>
<title>Plivo</title>
<authors>Plivo SDKs Team</authors>
<owners>Plivo, Inc.</owners>
<licenseUrl>https://github.com/plivo/plivo-dotnet/blob/master/LICENSE.txt</licenseUrl>
<projectUrl>http://github.com/plivo/plivo-dotnet</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>
* 4.2.3 Update Thread Safety handling for synchronous execution.
* 4.2.2 Fix dynamic object usage with async/await statement.
* 4.2.1 Fix Web Proxy support.
* 4.2.0 Changed base reference to .NET Standard 2.0 to support System.Web.Proxy. Added Strong Naming instructions
Expand Down
4 changes: 2 additions & 2 deletions src/Plivo/Resource/Account/AccountInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public AccountInterface(HttpClient client) : base(client)
/// <returns>The get.</returns>
public Account Get()
{
var account = GetResource<Account>("").Result;
var account = Task.Run(async () => await GetResource<Account>("").ConfigureAwait(false)).Result;
account.Interface = this;
return account;
}
Expand Down Expand Up @@ -55,7 +55,7 @@ public UpdateResponse<Account> Update(string name = null, string city = null, s
var mandatoryParams = new List<string> {"name"};
var data = CreateData(
mandatoryParams, new {name, city, address});
var result = Client.Update<UpdateResponse<Account>>(Uri, data).Result;
var result = Task.Run(async () => await Client.Update<UpdateResponse<Account>>(Uri, data).ConfigureAwait(false)).Result;
return result.Object;
}
/// <summary>
Expand Down
10 changes: 5 additions & 5 deletions src/Plivo/Resource/Address/AddressInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public AddressCreateResponse Create(
filesToUpload.Add("file", fileToUpload);
}

var result = Client.Update<AddressCreateResponse>(Uri, data, filesToUpload).Result;
var result = Task.Run(async () => await Client.Update<AddressCreateResponse>(Uri, data, filesToUpload).ConfigureAwait(false)).Result;

return result.Object;
}
Expand Down Expand Up @@ -280,7 +280,7 @@ public UpdateResponse<Address> Update(
filesToUpload.Add("file", fileToUpload);
}

var result = Client.Update<UpdateResponse<Address>>(Uri + addressId + "/", data, filesToUpload).Result;
var result = Task.Run(async () => await Client.Update<UpdateResponse<Address>>(Uri + addressId + "/", data, filesToUpload).ConfigureAwait(false)).Result;
return result.Object;
}

Expand Down Expand Up @@ -359,7 +359,7 @@ public async Task<UpdateResponse<Address>> UpdateAsync(
/// <param name="id">Identifier.</param>
public Address Get(string id)
{
var address = GetResource<Address>(id).Result;
var address = Task.Run(async () => await GetResource<Address>(id).ConfigureAwait(false)).Result;
address.Interface = this;
return address;
}
Expand Down Expand Up @@ -408,7 +408,7 @@ public ListResponse<Address> List(
limit,
offset
});
var resources = ListResources<ListResponse<Address>>(data).Result;
var resources = Task.Run(async () => await ListResources<ListResponse<Address>>(data).ConfigureAwait(false)).Result;
resources.Objects.ForEach(
(obj) => obj.Interface = this
);
Expand Down Expand Up @@ -472,7 +472,7 @@ public async Task<DeleteResponse<Address>> DeleteAsync(string id)
/// <param name="id">Identifier.</param>
public DeleteResponse<Address> Delete(string id)
{
return DeleteResource<DeleteResponse<Address>>(id).Result;
return Task.Run(async () => await DeleteResource<DeleteResponse<Address>>(id).ConfigureAwait(false)).Result;
}
#endregion
}
Expand Down
10 changes: 5 additions & 5 deletions src/Plivo/Resource/Application/ApplicationInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public ApplicationCreateResponse Create(
logIncomingMessages
});

var result = Client.Update<ApplicationCreateResponse>(Uri, data).Result;
var result = Task.Run(async () => await Client.Update<ApplicationCreateResponse>(Uri, data).ConfigureAwait(false)).Result;

return result.Object;
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public async Task<ApplicationCreateResponse> CreateAsync(
/// <param name="appId">App identifier.</param>
public Application Get(string appId)
{
var application = GetResource<Application>(appId).Result;
var application = Task.Run(async () => await GetResource<Application>(appId).ConfigureAwait(false)).Result;
application.Interface = this;
return application;
}
Expand Down Expand Up @@ -171,7 +171,7 @@ public ListResponse<Application> List(
var data = CreateData(
mandatoryParams, new { subaccount, limit, offset });

var resources = ListResources<ListResponse<Application>>(data).Result;
var resources = Task.Run(async () => await ListResources<ListResponse<Application>>(data).ConfigureAwait(false)).Result;
resources.Objects.ForEach(
(obj) => obj.Interface = this
);
Expand Down Expand Up @@ -209,7 +209,7 @@ public async Task<ListResponse<Application>> ListAsync(
/// <param name="appId">App identifier.</param>
public DeleteResponse<Application> Delete(string appId)
{
return DeleteResource<DeleteResponse<Application>>(appId).Result;
return Task.Run(async () => await DeleteResource<DeleteResponse<Application>>(appId).ConfigureAwait(false)).Result;
}
/// <summary>
/// Asynchronously delete Application with the specified appId.
Expand Down Expand Up @@ -268,7 +268,7 @@ public UpdateResponse<Application> Update(
logIncomingMessages
});

var result = Client.Update<UpdateResponse<Application>>(Uri + appId + "/", data).Result;
var result = Task.Run(async () => await Client.Update<UpdateResponse<Application>>(Uri + appId + "/", data).ConfigureAwait(false)).Result;
return result.Object;
}
/// <summary>
Expand Down
40 changes: 20 additions & 20 deletions src/Plivo/Resource/Call/CallInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public CallCreateResponse Create(
parentCallUuid,
errorIfrentNotFound
});
var result = Client.Update<CallCreateResponse>(Uri, data).Result;
var result = Task.Run(async () => await Client.Update<CallCreateResponse>(Uri, data).ConfigureAwait(false)).Result;
return result.Object;
}
/// <summary>
Expand Down Expand Up @@ -252,7 +252,7 @@ public ListResponse<Call> List(
limit,
offset
});
var resources = ListResources<ListResponse<Call>>(data).Result;
var resources = Task.Run(async () => await ListResources<ListResponse<Call>>(data).ConfigureAwait(false)).Result;
resources.Objects.ForEach(
(obj) => obj.Interface = this
);
Expand Down Expand Up @@ -349,7 +349,7 @@ public async Task<ListResponse<Call>> ListAsync(
/// <param name="callUuid">Call UUID.</param>
public Call Get(string callUuid)
{
var call = GetResource<Call>(callUuid).Result;
var call = Task.Run(async () => await GetResource<Call>(callUuid).ConfigureAwait(false)).Result;
call.Interface = this;
return call;
}
Expand Down Expand Up @@ -389,7 +389,7 @@ public LiveCallListResponse ListLive(string callDirection = null,
toNumber
});

return ListResources<LiveCallListResponse>(data).Result;
return Task.Run(async () => await ListResources<LiveCallListResponse>(data).ConfigureAwait(false)).Result;
}
/// <summary>
/// Lists the live.
Expand Down Expand Up @@ -425,8 +425,8 @@ public async Task<LiveCallListResponse> ListLiveAsync(string callDirection = nul
/// <param name="liveCallUuid">Live call UUID.</param>
public LiveCall GetLive(string liveCallUuid)
{
var liveCall = GetResource<LiveCall>(
liveCallUuid, new Dictionary<string, object>() { { "status", "live" } }).Result;
var liveCall = Task.Run(async () => await GetResource<LiveCall>(
liveCallUuid, new Dictionary<string, object>() { { "status", "live" } }).ConfigureAwait(false)).Result;
liveCall.Interface = this;
return liveCall;
}
Expand All @@ -452,8 +452,8 @@ public async Task<LiveCall> GetLiveAsync(string liveCallUuid)
/// <param name="callUuid">Call UUID.</param>
public QueuedCall GetQueued(string callUuid)
{
var queuedCall = GetResource<QueuedCall>(
callUuid, new Dictionary<string, object>() { { "status", "queued" } }).Result;
var queuedCall = Task.Run(async () => await GetResource<QueuedCall>(
callUuid, new Dictionary<string, object>() { { "status", "queued" } }).ConfigureAwait(false)).Result;
queuedCall.Interface = this;
return queuedCall;
}
Expand All @@ -478,8 +478,8 @@ public async Task<QueuedCall> GetQueuedAsync(string callUuid)
/// <returns>queued calls list</returns>
public QueuedCallListResponse ListQueued()
{
return ListResources<QueuedCallListResponse>(
new Dictionary<string, object>() { { "status", "queued" } }).Result;
return Task.Run(async () => await ListResources<QueuedCallListResponse>(
new Dictionary<string, object>() { { "status", "queued" } }).ConfigureAwait(false)).Result;
}
/// <summary>
/// Lists the queued calls.
Expand All @@ -501,7 +501,7 @@ await ListResources<QueuedCallListResponse>(
/// <param name="callUuid">Call UUID.</param>
public DeleteResponse<Call> Delete(string callUuid)
{
return DeleteResource<DeleteResponse<Call>>(callUuid).Result;
return Task.Run(async () => await DeleteResource<DeleteResponse<Call>>(callUuid).ConfigureAwait(false)).Result;
}
/// <summary>
/// Asynchronously delete Call with the specified callUuid.
Expand Down Expand Up @@ -541,7 +541,7 @@ public UpdateResponse<Call> Transfer(
blegUrl,
blegMethod
});
var result = Client.Update<UpdateResponse<Call>>(Uri + callUuid + "/", data).Result;
var result = Task.Run(async () => await Client.Update<UpdateResponse<Call>>(Uri + callUuid + "/", data).ConfigureAwait(false)).Result;
return result.Object;
}
/// <summary>
Expand Down Expand Up @@ -602,7 +602,7 @@ public UpdateResponse<Call> StartPlaying(
loop,
mix
});
var result = Client.Update<UpdateResponse<Call>>(Uri + callUuid + "/Play/", data).Result;
var result = Task.Run(async () => await Client.Update<UpdateResponse<Call>>(Uri + callUuid + "/Play/", data).ConfigureAwait(false)).Result;
return result.Object;
}
/// <summary>
Expand Down Expand Up @@ -644,7 +644,7 @@ public async Task<UpdateResponse<Call>> StartPlayingAsync(
/// <param name="callUuid">Call UUID.</param>
public DeleteResponse<Call> StopPlaying(string callUuid)
{
var result = Client.Delete<DeleteResponse<Call>>(Uri + callUuid + "/Play/").Result;
var result = Task.Run(async () => await Client.Delete<DeleteResponse<Call>>(Uri + callUuid + "/Play/").ConfigureAwait(false)).Result;
return result.Object;
}
/// <summary>
Expand Down Expand Up @@ -691,7 +691,7 @@ public RecordCreateResponse<Call> StartRecording(
callbackUrl,
callbackMethod
});
var result = Client.Update<RecordCreateResponse<Call>>(Uri + callUuid + "/Record/", data).Result;
var result = Task.Run(async () => await Client.Update<RecordCreateResponse<Call>>(Uri + callUuid + "/Record/", data).ConfigureAwait(false)).Result;
return result.Object;
}
/// <summary>
Expand Down Expand Up @@ -742,7 +742,7 @@ public DeleteResponse<Call> StopRecording(string callUuid, string URL = null)
var mandatoryParams = new List<string> { "" };
var data = CreateData(
mandatoryParams, new { URL });
var result = Client.Delete<DeleteResponse<Call>>(Uri + callUuid + "/Record/", data).Result;
var result = Task.Run(async () => await Client.Delete<DeleteResponse<Call>>(Uri + callUuid + "/Record/", data).ConfigureAwait(false)).Result;
return result.Object;
}
/// <summary>
Expand Down Expand Up @@ -790,7 +790,7 @@ public UpdateResponse<Call> StartSpeaking(
loop,
mix
});
var result = Client.Update<UpdateResponse<Call>>(Uri + callUuid + "/Speak/", data).Result;
var result = Task.Run(async () => await Client.Update<UpdateResponse<Call>>(Uri + callUuid + "/Speak/", data).ConfigureAwait(false)).Result;
return result.Object;
}
/// <summary>
Expand Down Expand Up @@ -835,7 +835,7 @@ public async Task<UpdateResponse<Call>> StartSpeakingAsync(
/// <param name="callUuid">Call UUID.</param>
public DeleteResponse<Call> StopSpeaking(string callUuid)
{
var result = Client.Delete<DeleteResponse<Call>>(Uri + callUuid + "/Speak/").Result;
var result = Task.Run(async () => await Client.Delete<DeleteResponse<Call>>(Uri + callUuid + "/Speak/").ConfigureAwait(false)).Result;
return result.Object;
}
/// <summary>
Expand Down Expand Up @@ -869,7 +869,7 @@ public UpdateResponse<Call> SendDigits(
digits,
leg
});
var result = Client.Update<UpdateResponse<Call>>(Uri + callUuid + "/DTMF/", data).Result;
var result = Task.Run(async () => await Client.Update<UpdateResponse<Call>>(Uri + callUuid + "/DTMF/", data).ConfigureAwait(false)).Result;
return result.Object;
}
/// <summary>
Expand Down Expand Up @@ -903,7 +903,7 @@ public async Task<UpdateResponse<Call>> SendDigitsAsync(
/// <param name="requestUuid">Request UUID.</param>
public DeleteResponse<Call> CancelCall(string requestUuid)
{
var result = Client.Delete<DeleteResponse<Call>>("Account/" + Client.GetAuthId() + "/Request/" + requestUuid + "/", null).Result;
var result = Task.Run(async () => await Client.Delete<DeleteResponse<Call>>("Account/" + Client.GetAuthId() + "/Request/" + requestUuid + "/", null).ConfigureAwait(false)).Result;
return result.Object;
}
/// <summary>
Expand Down
Loading

0 comments on commit 1501cc7

Please sign in to comment.