/// <summary> /// Creates an interaction or updates an existing interaction within a hub. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='hubName'> /// The name of the hub. /// </param> /// <param name='interactionName'> /// The name of the interaction. /// </param> /// <param name='parameters'> /// Parameters supplied to the CreateOrUpdate Interaction operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <InteractionResourceFormat> CreateOrUpdateAsync(this IInteractionsOperations operations, string resourceGroupName, string hubName, string interactionName, InteractionResourceFormat parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, hubName, interactionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public void SuggestRelationshipLinks() { using (var context = MockContext.Start(this.GetType().FullName)) { var aciClient = context.GetServiceClient <CustomerInsightsManagementClient>(); var profileName1 = TestUtilities.GenerateName("testProfile"); var profileName2 = TestUtilities.GenerateName("testProfile"); var interactionName1 = TestUtilities.GenerateName("testInteraction"); var profileResourceFormat1 = new ProfileResourceFormat { ApiEntitySetName = profileName1, Fields = new[] { new PropertyDefinition { FieldName = "ContactId", FieldType = "Edm.String", IsArray = false, IsRequired = true } }, StrongIds = new List <StrongId> { new StrongId { StrongIdName = "ContactId", KeyPropertyNames = new List <string> { "ContactId" } } } }; var profileResourceFormat2 = new ProfileResourceFormat { ApiEntitySetName = profileName2, Fields = new[] { new PropertyDefinition { FieldName = "BranchId", FieldType = "Edm.String", IsArray = false, IsRequired = true } }, StrongIds = new List <StrongId> { new StrongId { StrongIdName = "BranchId", KeyPropertyNames = new List <string> { "BranchId" } } } }; aciClient.Profiles.CreateOrUpdate(ResourceGroupName, HubName, profileName1, profileResourceFormat1); aciClient.Profiles.CreateOrUpdate(ResourceGroupName, HubName, profileName2, profileResourceFormat2); var interactionResourceFormat = new InteractionResourceFormat { ApiEntitySetName = interactionName1, Fields = new[] { new PropertyDefinition { FieldName = "ContactId", FieldType = "Edm.String" }, new PropertyDefinition { FieldName = "BranchId", FieldType = "Edm.String" } } }; aciClient.Interactions.CreateOrUpdate( ResourceGroupName, HubName, interactionName1, interactionResourceFormat); var linkName1 = TestUtilities.GenerateName("linkTest"); var linkName2 = TestUtilities.GenerateName("linkTest"); var linkResourceFormat1 = new LinkResourceFormat { TargetProfileType = profileName1, SourceInteractionType = interactionName1, ParticipantPropertyReferences = new[] { new ParticipantPropertyReference { ProfilePropertyName = "ContactId", InteractionPropertyName = "ContactId" } } }; var link1 = aciClient.Links.CreateOrUpdate(ResourceGroupName, HubName, linkName1, linkResourceFormat1); var linkResourceFormat2 = new LinkResourceFormat { TargetProfileType = profileName2, SourceInteractionType = interactionName1, ParticipantPropertyReferences = new[] { new ParticipantPropertyReference { ProfilePropertyName = "BranchId", InteractionPropertyName = "BranchId" } } }; var link2 = aciClient.Links.CreateOrUpdate(ResourceGroupName, HubName, linkName2, linkResourceFormat2); TestUtilities.Wait(5000); var suggestedRelationshipLinks = aciClient.Interactions.SuggestRelationshipLinks( ResourceGroupName, HubName, interactionName1); Assert.Equal(2, suggestedRelationshipLinks.SuggestedRelationships.Count); Assert.Equal(interactionName1, suggestedRelationshipLinks.InteractionName); Assert.True( ((suggestedRelationshipLinks.SuggestedRelationships[0].ProfileName == profileName1) && (suggestedRelationshipLinks.SuggestedRelationships[0].RelatedProfileName == profileName2)) || ((suggestedRelationshipLinks.SuggestedRelationships[0].ProfileName == profileName2) && (suggestedRelationshipLinks.SuggestedRelationships[0].RelatedProfileName == profileName1))); } }
/// <summary> /// Creates an interaction or updates an existing interaction within a hub. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='hubName'> /// The name of the hub. /// </param> /// <param name='interactionName'> /// The name of the interaction. /// </param> /// <param name='parameters'> /// Parameters supplied to the CreateOrUpdate Interaction operation. /// </param> public static InteractionResourceFormat CreateOrUpdate(this IInteractionsOperations operations, string resourceGroupName, string hubName, string interactionName, InteractionResourceFormat parameters) { return(operations.CreateOrUpdateAsync(resourceGroupName, hubName, interactionName, parameters).GetAwaiter().GetResult()); }