Search Results for

    Show / Hide Table of Contents

    Interop Migration

    Raising an Intent

    Intents now support a cleaner way of initialising the Intent payload object.

    • Original
    • New
    var interopClient = await runtime.Interop.ConnectAsync("the-broker");
    
    var intent = JsonConvert.DeserializeObject<Intent>(@$"{{
        'name': 'StartCall',
        'context': {{
                'type': 'fdc3.contact',
                'name': 'Andy',
                'id': {{
                        'email': 'andy@hisemail.com'
                }}
            }}
    }}");
    
    var result = await interopClient.FireIntentAsync(intent);
    
    var interop = runtime.GetService<IInterop>();
    
    interopClient = await interop.ConnectAsync("the-broker");
    
    var intent = new Intent
    {
        Name = "StartCall",
        Context = new Context
        {
            Type = "fdc3.contact",
            Name = "Andy",
            Id = new
            {
                email = "andy@hisemail.com"
            }
        }
    };
    await interopClient.FireIntentAsync(intent);
    

    Setting a Context

    The Context payload object is now easily settable and does not require either a Json deserialize or inheritence work to set.

    • Original
    • New
    var interopClient = await runtime.Interop.ConnectAsync("the-broker");
    
    await interopClient.JoinContextGroupAsync("green");
    
    var contactContext = JsonConvert.DeserializeObject<Context>(@$"{{
            'type': 'fdc3.contact',
            'name': 'Andy',
            'id': {{
                    'email': 'andy@hisemail.com'
            }}
    }}");
    
    var result = await interopClient.FireIntentAsync(intent);
    
    var interop = runtime.GetService<IInterop>();
    
    interopClient = await interop.ConnectAsync("the-broker");
    
    await interopClient.JoinContextGroupAsync("green");
    
    var context = new Context
    {
        Type = "fdc3.contact",
        Name = "Andy",
        Id = new
        {
            email = "andy@hisemail.com"
        }
    };
    await interopClient.SetContextAsync(context);
    
    In This Article
    Back to top Copyright OpenFin