Skip to content

Commit b6fbb87

Browse files
swagatmishra2007Swagat Mishra
authored andcommitted
fix lack of a generic typed method for posting activities to skills (#3539)
* fix lack of a generic typed method for posting activities to skills * remove duplicated code Co-authored-by: Swagat Mishra <swagatm@microsoft.com>
1 parent 4aee5e9 commit b6fbb87

File tree

1 file changed

+9
-3
lines changed
  • libraries/integration/Microsoft.Bot.Builder.Integration.AspNet.Core/Skills

1 file changed

+9
-3
lines changed

libraries/integration/Microsoft.Bot.Builder.Integration.AspNet.Core/Skills/SkillHttpClient.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ public SkillHttpClient(HttpClient httpClient, ICredentialProvider credentialProv
2828
/// <summary>
2929
/// Uses the SkillConversationIdFactory to create or retrieve a Skill Conversation Id, and sends the activity.
3030
/// </summary>
31+
/// <typeparam name="T">The type of body in the InvokeResponse.</typeparam>
3132
/// <param name="originatingAudience">The oauth audience scope, used during token retrieval. (Either https://api.botframework.com or bot app id.)</param>
3233
/// <param name="fromBotId">The MicrosoftAppId of the bot sending the activity.</param>
3334
/// <param name="toSkill">The skill to create the conversation Id for.</param>
3435
/// <param name="callbackUrl">The callback Url for the skill host.</param>
3536
/// <param name="activity">The activity to send.</param>
3637
/// <param name="cancellationToken">A cancellation token.</param>
3738
/// <returns>Async task with invokeResponse.</returns>
38-
public async Task<InvokeResponse> PostActivityAsync(string originatingAudience, string fromBotId, BotFrameworkSkill toSkill, Uri callbackUrl, Activity activity, CancellationToken cancellationToken)
39+
public async Task<InvokeResponse<T>> PostActivityAsync<T>(string originatingAudience, string fromBotId, BotFrameworkSkill toSkill, Uri callbackUrl, Activity activity, CancellationToken cancellationToken)
3940
{
4041
string skillConversationId;
4142
try
@@ -57,13 +58,18 @@ public async Task<InvokeResponse> PostActivityAsync(string originatingAudience,
5758
#pragma warning restore 618
5859
}
5960

60-
return await PostActivityAsync(fromBotId, toSkill.AppId, toSkill.SkillEndpoint, callbackUrl, skillConversationId, activity, cancellationToken).ConfigureAwait(false);
61+
return await PostActivityAsync<T>(fromBotId, toSkill.AppId, toSkill.SkillEndpoint, callbackUrl, skillConversationId, activity, cancellationToken).ConfigureAwait(false);
6162
}
6263

6364
public async Task<InvokeResponse> PostActivityAsync(string fromBotId, BotFrameworkSkill toSkill, Uri callbackUrl, Activity activity, CancellationToken cancellationToken)
65+
{
66+
return await PostActivityAsync<object>(fromBotId, toSkill, callbackUrl, activity, cancellationToken).ConfigureAwait(false);
67+
}
68+
69+
public async Task<InvokeResponse<T>> PostActivityAsync<T>(string fromBotId, BotFrameworkSkill toSkill, Uri callbackUrl, Activity activity, CancellationToken cancellationToken)
6470
{
6571
var originatingAudience = ChannelProvider != null && ChannelProvider.IsGovernment() ? GovernmentAuthenticationConstants.ToChannelFromBotOAuthScope : AuthenticationConstants.ToChannelFromBotOAuthScope;
66-
return await PostActivityAsync(originatingAudience, fromBotId, toSkill, callbackUrl, activity, cancellationToken).ConfigureAwait(false);
72+
return await PostActivityAsync<T>(originatingAudience, fromBotId, toSkill, callbackUrl, activity, cancellationToken).ConfigureAwait(false);
6773
}
6874
}
6975
}

0 commit comments

Comments
 (0)